From c08e1873c40e54db7292909a2d5f9113e465dba5 Mon Sep 17 00:00:00 2001 From: RunDevelopment Date: Thu, 4 Apr 2024 15:15:13 +0200 Subject: [PATCH] Don't create empty `settings_old` folder for fresh installs --- 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)),