diff --git a/Cargo.lock b/Cargo.lock index 0063a3e0..320bc3d9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -385,7 +385,6 @@ dependencies = [ "base64", "bytes", "clap", - "directories", "figment", "futures-util", "hmac", @@ -599,26 +598,6 @@ dependencies = [ "subtle", ] -[[package]] -name = "directories" -version = "4.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f51c5d4ddabd36886dd3e1438cb358cdcb0d7c499cb99cb4ac2e38e18b5cb210" -dependencies = [ - "dirs-sys", -] - -[[package]] -name = "dirs-sys" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b1d1d91c932ef41c0f2663aa8b0ca0342d444d842c06914aa0a7e352d0bada6" -dependencies = [ - "libc", - "redox_users", - "winapi", -] - [[package]] name = "ed25519" version = "2.2.3" @@ -1281,17 +1260,6 @@ dependencies = [ "windows-targets 0.52.4", ] -[[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 = "libsqlite3-sys" version = "0.26.0" @@ -1863,17 +1831,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 4dfc04f3..6ebdbf6a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -51,8 +51,6 @@ persy = { version = "1.4.4", optional = true, features = ["background_ops"] } # Used for the http request / response body type for Ruma endpoints used with reqwest bytes = "1.4.0" http = "0.2.9" -# Used to find data directory for default db path -directories = "4.0.1" # Used for ruma wrapper serde_json = { version = "1.0.96", features = ["raw_value"] } # Used for appservice registration files diff --git a/src/database/mod.rs b/src/database/mod.rs index 7008d56f..f4cf6a4c 100644 --- a/src/database/mod.rs +++ b/src/database/mod.rs @@ -6,7 +6,6 @@ use crate::{ SERVICES, }; use abstraction::{KeyValueDatabaseEngine, KvTree}; -use directories::ProjectDirs; use lru_cache::LruCache; use ruma::{ @@ -21,7 +20,7 @@ use ruma::{ }; use std::{ collections::{BTreeMap, HashMap, HashSet}, - fs::{self, remove_dir_all}, + fs, io::Write, mem::size_of, path::Path, @@ -170,18 +169,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);