From fd45068a464fef5da0a9ccf1bacae17c6c8eda32 Mon Sep 17 00:00:00 2001 From: V Date: Wed, 21 Jun 2023 17:09:04 +0200 Subject: [PATCH 1/2] autoStart: respect XDG_CONFIG_HOME --- src/main/autoStart.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/main/autoStart.ts b/src/main/autoStart.ts index 17ee6fd..1a31b07 100644 --- a/src/main/autoStart.ts +++ b/src/main/autoStart.ts @@ -15,7 +15,8 @@ interface AutoStart { } function makeAutoStartLinux(): AutoStart { - const dir = join(process.env.HOME!, ".config", "autostart"); + const configDir = process.env.XDG_CONFIG_HOME || join(process.env.HOME!, ".config"); + const dir = join(configDir, "autostart"); const file = join(dir, "vencord.desktop"); return { From 23c0647e6cf8f1bfb67912ceb60b2a5c69c7b637 Mon Sep 17 00:00:00 2001 From: V Date: Wed, 21 Jun 2023 17:24:50 +0200 Subject: [PATCH 2/2] Fix ENOENT on first install --- src/main/settings.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/main/settings.ts b/src/main/settings.ts index 3061509..dfb7474 100644 --- a/src/main/settings.ts +++ b/src/main/settings.ts @@ -4,8 +4,8 @@ * Copyright (c) 2023 Vendicated and Vencord contributors */ -import { readFileSync, writeFileSync } from "fs"; -import { join } from "path"; +import { mkdirSync, readFileSync, writeFileSync } from "fs"; +import { dirname, join } from "path"; import type { Settings as TSettings } from "shared/settings"; import { SettingsStore } from "shared/utils/SettingsStore"; @@ -25,7 +25,10 @@ function loadSettings(file: string, name: string) { } catch {} const store = new SettingsStore(settings); - store.addGlobalChangeListener(o => writeFileSync(file, JSON.stringify(o, null, 4))); + store.addGlobalChangeListener(o => { + mkdirSync(dirname(file), { recursive: true }); + writeFileSync(file, JSON.stringify(o, null, 4)); + }); return store; }