Finish settings import
This commit is contained in:
parent
09b4636db3
commit
6383a56273
1 changed files with 17 additions and 0 deletions
|
@ -6,10 +6,12 @@
|
||||||
|
|
||||||
import { app } from "electron";
|
import { app } from "electron";
|
||||||
import { BrowserWindow } from "electron/main";
|
import { BrowserWindow } from "electron/main";
|
||||||
|
import { copyFileSync, mkdirSync, readdirSync } from "fs";
|
||||||
import { join } from "path";
|
import { join } from "path";
|
||||||
import { SplashProps } from "shared/browserWinProperties";
|
import { SplashProps } from "shared/browserWinProperties";
|
||||||
import { STATIC_DIR } from "shared/paths";
|
import { STATIC_DIR } from "shared/paths";
|
||||||
|
|
||||||
|
import { DATA_DIR } from "./constants";
|
||||||
import { createWindows } from "./mainWindow";
|
import { createWindows } from "./mainWindow";
|
||||||
import { Settings } from "./settings";
|
import { Settings } from "./settings";
|
||||||
|
|
||||||
|
@ -33,6 +35,21 @@ export function createFirstLaunchTour() {
|
||||||
Settings.store.discordBranch = data.discordBranch;
|
Settings.store.discordBranch = data.discordBranch;
|
||||||
Settings.store.firstLaunch = false;
|
Settings.store.firstLaunch = false;
|
||||||
|
|
||||||
|
if (data.importSettings) {
|
||||||
|
const from = join(app.getPath("userData"), "..", "Vencord", "settings");
|
||||||
|
const to = join(DATA_DIR, "settings");
|
||||||
|
try {
|
||||||
|
const files = readdirSync(from);
|
||||||
|
mkdirSync(to, { recursive: true });
|
||||||
|
|
||||||
|
for (const file of files) {
|
||||||
|
copyFileSync(join(from, file), join(to, file));
|
||||||
|
}
|
||||||
|
} catch (e) {
|
||||||
|
console.error("Failed to import settings:", e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
win.close();
|
win.close();
|
||||||
|
|
||||||
createWindows();
|
createWindows();
|
||||||
|
|
Reference in a new issue