Skip to content

Commit

Permalink
Fixed problem when settings file cannot be written because there is n…
Browse files Browse the repository at this point in the history
…o folder
  • Loading branch information
opengs committed Sep 6, 2024
1 parent 7ec2eeb commit c98609f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src-electron/handlers/settings.ts
Original file line number Diff line number Diff line change
@@ -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';
Expand Down Expand Up @@ -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))
}

Expand Down

0 comments on commit c98609f

Please sign in to comment.