config: handle config deleted
Revert to defaults if config file moved/deleted
This commit is contained in:
parent
4a1a3a6d89
commit
5d5bea5758
1 changed files with 3 additions and 1 deletions
|
|
@ -100,7 +100,9 @@ const updateSection = (from: { [k: string]: any }, to: { [k: string]: any }, pat
|
|||
};
|
||||
|
||||
export const updateConfig = async () => {
|
||||
updateSection(deepMerge(defaults, JSON.parse(await readFileAsync(CONFIG))), config);
|
||||
if (GLib.file_test(CONFIG, GLib.FileTest.EXISTS))
|
||||
updateSection(deepMerge(defaults, JSON.parse(await readFileAsync(CONFIG))), config);
|
||||
else updateSection(defaults, config);
|
||||
await loadStyleAsync();
|
||||
console.log("[LOG] Config updated");
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue