Fix: Create SETTINGS_DIR if it doesnt exist

This commit is contained in:
Vendicated 2022-09-02 04:55:03 +02:00
parent eef407e991
commit 138682f3eb
No known key found for this signature in database
GPG key ID: EC781ADFB93EFFA3

View file

@ -1,5 +1,5 @@
import { app, BrowserWindow, ipcMain, shell } from "electron"; 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 { open, readFile, writeFile } from "fs/promises";
import { join } from 'path'; import { join } from 'path';
import IpcEvents from './utils/IpcEvents'; 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 QUICKCSS_PATH = join(SETTINGS_DIR, "quickCss.css");
const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json"); const SETTINGS_FILE = join(SETTINGS_DIR, "settings.json");
mkdirSync(SETTINGS_DIR, { recursive: true });
function readCss() { function readCss() {
return readFile(QUICKCSS_PATH, "utf-8").catch(() => ""); return readFile(QUICKCSS_PATH, "utf-8").catch(() => "");
} }