fix: use proper data directory

main
Jan Christian Grünhage 7 months ago
parent f81a036750
commit 21010498d2
Signed by: jcgruenhage
GPG Key ID: EEC1170CE56FA2ED

8
Cargo.lock generated

@ -454,10 +454,10 @@ dependencies = [
]
[[package]]
name = "dirs"
version = "4.0.0"
name = "directories"
version = "4.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca3aa72a6f96ea37bbc5aa912f6788242832f75369bdfdadcb0e38423f100059"
checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210"
dependencies = [
"dirs-sys",
]
@ -1003,7 +1003,7 @@ name = "matrix-example-bot"
version = "0.1.0"
dependencies = [
"anyhow",
"dirs",
"directories",
"matrix-sdk",
"tokio",
"tracing-subscriber",

@ -8,7 +8,7 @@ license-file = "LICENSE.md"
[dependencies]
anyhow = "1.0.58"
dirs = "4.0.0"
directories = "4.0.1"
matrix-sdk = "0.5.0"
tokio = { version = "1.20.0", features = ["rt-multi-thread", "macros"] }
tracing-subscriber = "0.3.15"

@ -81,9 +81,8 @@ async fn login_and_sync(
let mut client_builder = Client::builder().homeserver_url(homeserver_url);
// The location to save files to
let mut home = dirs::home_dir().expect("no home directory found");
home.push("party_bot");
let state_store = StateStore::open_with_path(home)?;
let proj_dirs = directories::ProjectDirs::from("de", "Entropia", "Matrix Rust Example Bot").unwrap();
let state_store = StateStore::open_with_path(proj_dirs.data_dir())?;
client_builder = client_builder.state_store(Box::new(state_store));
let client = client_builder.build().await.unwrap();

Loading…
Cancel
Save