From 138682f3eb28cfc76ef8cb5128f2537f00821e90 Mon Sep 17 00:00:00 2001 From: Vendicated Date: Fri, 2 Sep 2022 04:55:03 +0200 Subject: [PATCH] Fix: Create SETTINGS_DIR if it doesnt exist --- src/ipcMain.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/ipcMain.ts b/src/ipcMain.ts index 80bff55bb..a35b248c4 100644 --- a/src/ipcMain.ts +++ b/src/ipcMain.ts @@ -1,5 +1,5 @@ import { app, BrowserWindow, ipcMain, shell } from "electron"; -import { readFileSync, watch } from "fs"; +import { mkdirSync, readFileSync, watch } from "fs"; import { open, readFile, writeFile } from "fs/promises"; import { join } from 'path'; import IpcEvents from './utils/IpcEvents'; @@ -9,6 +9,8 @@ const SETTINGS_DIR = join(DATA_DIR, "settings"); const QUICKCSS_PATH = join(SETTINGS_DIR, "quickCss.css"); const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json"); +mkdirSync(SETTINGS_DIR, { recursive: true }); + function readCss() { return readFile(QUICKCSS_PATH, "utf-8").catch(() => ""); }