Copy setting and keymap files from legacy config locations

This commit is contained in:
Antonio Scandurra 2022-07-29 09:57:38 +02:00
parent 5f6e4c7d91
commit f2d92d640d
3 changed files with 45 additions and 19 deletions

View file

@ -1,22 +1,24 @@
use std::{env, path::PathBuf};
use std::path::PathBuf;
use lazy_static::lazy_static;
lazy_static! {
lazy_static::lazy_static! {
static ref HOME: PathBuf = dirs::home_dir().expect("failed to determine home directory");
static ref CACHE_DIR: PathBuf = dirs::cache_dir()
.expect("failed to determine cache directory")
.join("Zed");
pub static ref CONFIG_DIR: PathBuf = env::var_os("XDG_CONFIG_HOME")
.map(|home| home.into())
.unwrap_or_else(|| HOME.join(".config"))
.join("zed");
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 = CACHE_DIR.join("languages");
pub static ref DB_DIR: PathBuf = CACHE_DIR.join("db");
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 DB: PathBuf = DB_DIR.join("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 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");
}
}