From a63c6522a2dbd6e05bf174645e1f2793c9f2900e Mon Sep 17 00:00:00 2001 From: Michael Schmidt Date: Thu, 4 Apr 2024 16:56:51 +0200 Subject: [PATCH] Don't create empty `settings_old` folder for fresh installs (#2735) --- src/main/setting-storage.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/main/setting-storage.ts b/src/main/setting-storage.ts index 7d926fc18..48c265e40 100644 --- a/src/main/setting-storage.ts +++ b/src/main/setting-storage.ts @@ -19,6 +19,11 @@ export const readSettings = (): ChainnerSettings => { // legacy settings const storagePath = path.join(getRootDirSync(), 'settings'); + if (!existsSync(storagePath)) { + // neither settings.json nor old settings exist, so this is a fresh install + return { ...defaultSettings }; + } + const storage = new LocalStorage(storagePath); const partialSettings = migrateOldStorageSettings({ keys: Array.from({ length: storage.length }, (_, i) => storage.key(i)),