config storing
This commit is contained in:
parent
df53857426
commit
95c34fb431
3 changed files with 7 additions and 8 deletions
|
|
@ -35,11 +35,11 @@ impl Default for CoreCFG {
|
|||
pub fn load_config(path: Option<PathBuf>) -> Config {
|
||||
match path {
|
||||
Some(p) => confy::load_path(p).expect("Configuration could not be loaded"),
|
||||
None => confy::load("apographe", Some("config"))
|
||||
None => confy::load("apograph", Some("config"))
|
||||
.ok()
|
||||
.unwrap_or_else(|| {
|
||||
let config: Config = Config::default();
|
||||
let _ = confy::store("aphorme", Some("config"), Config::default());
|
||||
let _ = confy::store("apograph", Some("config"), Config::default());
|
||||
config
|
||||
}),
|
||||
}
|
||||
|
|
@ -68,6 +68,7 @@ pub fn set_basepath(app_handle: tauri::AppHandle, path: String) -> bool {
|
|||
// Lock the mutex to get mutable access:
|
||||
let mut config = config.lock().unwrap();
|
||||
config.core_cfg.home_path = Some(basepath);
|
||||
let _ = confy::store("apograph", Some("config"), config.clone());
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue