From c98609f87dbefedfb36405de16b60e8b18e7f2f4 Mon Sep 17 00:00:00 2001 From: Mykola Zhyhallo Date: Fri, 6 Sep 2024 17:06:00 +0200 Subject: [PATCH] Fixed problem when settings file cannot be written because there is no folder --- src-electron/handlers/settings.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src-electron/handlers/settings.ts b/src-electron/handlers/settings.ts index 6856aec..68cfaa5 100644 --- a/src-electron/handlers/settings.ts +++ b/src-electron/handlers/settings.ts @@ -1,4 +1,4 @@ -import { join as joinPath }from 'path' +import { join as joinPath, dirname }from 'path' import { app, ipcMain } from 'electron' import { promises as fsPromises, readFileSync, existsSync } from 'fs' import EventEmitter from 'events'; @@ -99,6 +99,7 @@ export class Settings { } async save() { + await fsPromises.mkdir(dirname(Settings.settingsFile), { recursive: true }) await fsPromises.writeFile(Settings.settingsFile, JSON.stringify(this.data)) }