implement command to reload config (#243)

* implement command to reload themes

* refresh keybindings after config reload
This commit is contained in:
Henrik Friedrichsen
2020-08-12 01:12:08 +02:00
committed by GitHub
parent 9e5e3f3089
commit 4f71b2489b
5 changed files with 76 additions and 37 deletions

View File

@@ -53,6 +53,11 @@ lazy_static! {
pub static ref BASE_PATH: RwLock<Option<PathBuf>> = RwLock::new(None);
}
pub fn load() -> Result<Config, String> {
let path = config_path("config.toml");
load_or_generate_default(path, |_| Ok(Config::default()), false)
}
fn proj_dirs() -> ProjectDirs {
match *BASE_PATH.read().expect("can't readlock BASE_PATH") {
Some(ref basepath) => ProjectDirs::from_path(basepath.clone()).expect("invalid basepath"),