This commit is contained in:
Mikayla Maki 2022-11-14 11:25:11 -08:00
parent a5edac312e
commit 2a5565ca93
7 changed files with 16 additions and 17 deletions

View file

@ -19,6 +19,7 @@ rand = { workspace = true }
tempdir = { version = "0.3.7", optional = true }
serde_json = { version = "1.0", features = ["preserve_order"], optional = true }
git2 = { version = "0.15", default-features = false, optional = true }
dirs = "3.0"
[dev-dependencies]

View file

@ -1,3 +1,4 @@
pub mod paths;
#[cfg(any(test, feature = "test-support"))]
pub mod test;

24
crates/util/src/paths.rs Normal file
View file

@ -0,0 +1,24 @@
use std::path::PathBuf;
lazy_static::lazy_static! {
pub static ref HOME: PathBuf = dirs::home_dir().expect("failed to determine home directory");
pub static ref CONFIG_DIR: PathBuf = HOME.join(".config").join("zed");
pub static ref LOGS_DIR: PathBuf = HOME.join("Library/Logs/Zed");
pub static ref LANGUAGES_DIR: PathBuf = HOME.join("Library/Application Support/Zed/languages");
pub static ref DB_DIR: PathBuf = HOME.join("Library/Application Support/Zed/db");
pub static ref SETTINGS: PathBuf = CONFIG_DIR.join("settings.json");
pub static ref KEYMAP: PathBuf = CONFIG_DIR.join("keymap.json");
pub static ref LAST_USERNAME: PathBuf = CONFIG_DIR.join("last-username.txt");
pub static ref LOG: PathBuf = LOGS_DIR.join("Zed.log");
pub static ref OLD_LOG: PathBuf = LOGS_DIR.join("Zed.log.old");
}
pub mod legacy {
use std::path::PathBuf;
lazy_static::lazy_static! {
static ref CONFIG_DIR: PathBuf = super::HOME.join(".zed");
pub static ref SETTINGS: PathBuf = CONFIG_DIR.join("settings.json");
pub static ref KEYMAP: PathBuf = CONFIG_DIR.join("keymap.json");
}
}