diff --git a/Cargo.lock b/Cargo.lock index f03d5b5..d0cc011 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -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", diff --git a/Cargo.toml b/Cargo.toml index 5a0b739..8acbcc2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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" diff --git a/src/main.rs b/src/main.rs index 49c3315..908f0a8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -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();