remove legacy code
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||
import { mkdirSync, readFileSync, writeFileSync } from "fs";
|
||||
import { dirname, join } from "path";
|
||||
import type { Settings as TSettings, State as TState } from "shared/settings";
|
||||
import { SettingsStore } from "shared/utils/SettingsStore";
|
||||
@@ -35,18 +35,5 @@ function loadSettings<T extends object = any>(file: string, name: string) {
|
||||
}
|
||||
|
||||
export const Settings = loadSettings<TSettings>(SETTINGS_FILE, "Vesktop settings");
|
||||
|
||||
export const VencordSettings = loadSettings<any>(VENCORD_SETTINGS_FILE, "Vencord settings");
|
||||
|
||||
if (Object.hasOwn(Settings.plain, "firstLaunch") && !existsSync(STATE_FILE)) {
|
||||
console.warn("legacy state in settings.json detected. migrating to state.json");
|
||||
const state = {} as TState;
|
||||
for (const prop of ["firstLaunch", "maximized", "minimized", "steamOSLayoutVersion", "windowBounds"] as const) {
|
||||
state[prop] = Settings.plain[prop];
|
||||
delete Settings.plain[prop];
|
||||
}
|
||||
Settings.markAsChanged();
|
||||
writeFileSync(STATE_FILE, JSON.stringify(state, null, 4));
|
||||
}
|
||||
|
||||
export const State = loadSettings<TState>(STATE_FILE, "Vesktop state");
|
||||
|
||||
Reference in New Issue
Block a user