paths.rs

 1use std::{ops::Deref, path::PathBuf};
 2
 3#[derive(Debug)]
 4pub struct StaffMode(pub bool);
 5
 6impl Deref for StaffMode {
 7    type Target = bool;
 8
 9    fn deref(&self) -> &Self::Target {
10        &self.0
11    }
12}
13
14lazy_static::lazy_static! {
15    pub static ref HOME: PathBuf = dirs::home_dir().expect("failed to determine home directory");
16    pub static ref CONFIG_DIR: PathBuf = HOME.join(".config").join("zed");
17    pub static ref LOGS_DIR: PathBuf = HOME.join("Library/Logs/Zed");
18    pub static ref LANGUAGES_DIR: PathBuf = HOME.join("Library/Application Support/Zed/languages");
19    pub static ref DB_DIR: PathBuf = HOME.join("Library/Application Support/Zed/db");
20    pub static ref SETTINGS: PathBuf = CONFIG_DIR.join("settings.json");
21    pub static ref KEYMAP: PathBuf = CONFIG_DIR.join("keymap.json");
22    pub static ref LAST_USERNAME: PathBuf = CONFIG_DIR.join("last-username.txt");
23    pub static ref LOG: PathBuf = LOGS_DIR.join("Zed.log");
24    pub static ref OLD_LOG: PathBuf = LOGS_DIR.join("Zed.log.old");
25}
26
27pub mod legacy {
28    use std::path::PathBuf;
29
30    lazy_static::lazy_static! {
31        static ref CONFIG_DIR: PathBuf = super::HOME.join(".zed");
32        pub static ref SETTINGS: PathBuf = CONFIG_DIR.join("settings.json");
33        pub static ref KEYMAP: PathBuf = CONFIG_DIR.join("keymap.json");
34    }
35}