Copy setting and keymap files from legacy config locations
This commit is contained in:
parent
5f6e4c7d91
commit
f2d92d640d
3 changed files with 45 additions and 19 deletions
|
@ -42,9 +42,7 @@ use zed::{
|
|||
|
||||
fn main() {
|
||||
let http = http::client();
|
||||
fs::create_dir_all(&*zed::paths::LANGUAGES_DIR).expect("could not create languages path");
|
||||
fs::create_dir_all(&*zed::paths::DB_DIR).expect("could not create database path");
|
||||
fs::create_dir_all(&*zed::paths::LOGS_DIR).expect("could not create logs path");
|
||||
init_paths();
|
||||
init_logger();
|
||||
|
||||
log::info!("========== starting zed ==========");
|
||||
|
@ -195,6 +193,28 @@ fn main() {
|
|||
});
|
||||
}
|
||||
|
||||
fn init_paths() {
|
||||
fs::create_dir_all(&*zed::paths::CONFIG_DIR).expect("could not create config path");
|
||||
fs::create_dir_all(&*zed::paths::LANGUAGES_DIR).expect("could not create languages path");
|
||||
fs::create_dir_all(&*zed::paths::DB_DIR).expect("could not create database path");
|
||||
fs::create_dir_all(&*zed::paths::LOGS_DIR).expect("could not create logs path");
|
||||
|
||||
// Copy setting files from legacy locations. TODO: remove this after a few releases.
|
||||
thread::spawn(|| {
|
||||
if fs::metadata(&*zed::paths::legacy::SETTINGS).is_ok()
|
||||
&& fs::metadata(&*zed::paths::SETTINGS).is_err()
|
||||
{
|
||||
fs::copy(&*zed::paths::legacy::SETTINGS, &*zed::paths::SETTINGS).log_err();
|
||||
}
|
||||
|
||||
if fs::metadata(&*zed::paths::legacy::KEYMAP).is_ok()
|
||||
&& fs::metadata(&*zed::paths::KEYMAP).is_err()
|
||||
{
|
||||
fs::copy(&*zed::paths::legacy::KEYMAP, &*zed::paths::KEYMAP).log_err();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
fn init_logger() {
|
||||
if stdout_is_a_pty() {
|
||||
env_logger::init();
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue