From 5d5bea575836c4427619e68fb535d45390154b49 Mon Sep 17 00:00:00 2001 From: 2 * r + 2 * t <61896496+soramanew@users.noreply.github.com> Date: Mon, 7 Apr 2025 14:58:58 +1000 Subject: config: handle config deleted Revert to defaults if config file moved/deleted --- src/config/funcs.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src') diff --git a/src/config/funcs.ts b/src/config/funcs.ts index fbfb88e..77ee8dd 100644 --- a/src/config/funcs.ts +++ b/src/config/funcs.ts @@ -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"); }; -- cgit v1.2.3-freya