diff --git a/Cargo.lock b/Cargo.lock index a111669a..44d6955c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -392,7 +392,6 @@ dependencies = [ "base64", "bytes", "clap", - "directories", "figment", "futures-util", "hmac", @@ -577,27 +576,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "directories" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" -dependencies = [ - "libc", - "option-ext", - "redox_users", - "windows-sys 0.48.0", -] - [[package]] name = "ed25519" version = "2.2.3" @@ -1269,17 +1247,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "libredox" -version = "0.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85c833ca1e66078851dba29046874e38f08b2c883700aa29a03ddd3b23814ee8" -dependencies = [ - "bitflags 2.4.2", - "libc", - "redox_syscall", -] - [[package]] name = "librocksdb-sys" version = "0.16.0+8.10.0" @@ -1669,12 +1636,6 @@ dependencies = [ "tokio-stream", ] -[[package]] -name = "option-ext" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" - [[package]] name = "ordered-float" version = "2.10.1" @@ -1987,17 +1948,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "redox_users" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a18479200779601e498ada4e8c1e1f50e3ee19deb0259c25825a98b5603b2cb4" -dependencies = [ - "getrandom", - "libredox", - "thiserror", -] - [[package]] name = "regex" version = "1.10.3" diff --git a/Cargo.toml b/Cargo.toml index 719f4f24..a3707a7c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -37,8 +37,6 @@ tokio = { version = "1.36.0", features = ["fs", "macros", "signal", "sync"] } # Used for the http request / response body type for Ruma endpoints used with reqwest bytes = "1.5.0" http = "0.2.11" -# Used to find data directory for default db path -directories = "5.0.1" # Used for ruma wrapper serde_json = { version = "1.0.113", features = ["raw_value"] } # Used for appservice registration files diff --git a/src/database/mod.rs b/src/database/mod.rs index 26cb8803..d3edf133 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -7,7 +7,6 @@ use crate::{ }; use abstraction::{KeyValueDatabaseEngine, KvTree}; use argon2::{password_hash::SaltString, PasswordHasher, PasswordVerifier}; -use directories::ProjectDirs; use itertools::Itertools; use lru_cache::LruCache; use rand::thread_rng; @@ -25,7 +24,7 @@ use ruma::{ use serde::Deserialize; use std::{ collections::{BTreeMap, HashMap, HashSet}, - fs::{self, remove_dir_all}, + fs::{self}, io::Write, mem::size_of, path::Path, @@ -180,18 +179,6 @@ pub struct KeyValueDatabase { } impl KeyValueDatabase { - /// Tries to remove the old database but ignores all errors. - pub fn try_remove(server_name: &str) -> Result<()> { - let mut path = ProjectDirs::from("xyz", "koesters", "conduit") - .ok_or_else(|| Error::bad_config("The OS didn't return a valid home directory path."))? - .data_dir() - .to_path_buf(); - path.push(server_name); - let _ = remove_dir_all(path); - - Ok(()) - } - fn check_db_setup(config: &Config) -> Result<()> { let path = Path::new(&config.database_path);