Merge branch 'main' into screenshare

This commit is contained in:
V 2023-06-21 17:25:31 +02:00 committed by GitHub
commit b5ee5b1bbe
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 4 deletions

View file

@ -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 {

View file

@ -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<T extends object = any>(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;
}