fixed portable check for unpackaged
This commit is contained in:
parent
4d0867d6f5
commit
c65e9c4f2c
2 changed files with 7 additions and 4 deletions
|
@ -5,16 +5,21 @@
|
|||
*/
|
||||
|
||||
import { app } from "electron";
|
||||
import { existsSync, readdirSync, renameSync, rmdirSync } from "fs";
|
||||
import { existsSync, mkdirSync, readdirSync, renameSync, rmdirSync } from "fs";
|
||||
import { dirname, join } from "path";
|
||||
|
||||
const vesktopDir = dirname(process.execPath);
|
||||
export const PORTABLE = process.platform === "win32" && !readdirSync(vesktopDir).includes("Uninstall Vesktop.exe");
|
||||
|
||||
export const PORTABLE =
|
||||
process.platform === "win32" &&
|
||||
!readdirSync(vesktopDir).includes("Uninstall Vesktop.exe") &&
|
||||
!process.execPath.endsWith("electron");
|
||||
|
||||
const LEGACY_DATA_DIR = join(app.getPath("appData"), "VencordDesktop", "VencordDesktop");
|
||||
export const DATA_DIR = PORTABLE
|
||||
? join(vesktopDir, "Data")
|
||||
: process.env.VENCORD_USER_DATA_DIR || join(app.getPath("userData"));
|
||||
mkdirSync(DATA_DIR, { recursive: true });
|
||||
|
||||
// TODO: remove eventually
|
||||
if (existsSync(LEGACY_DATA_DIR)) {
|
||||
|
|
|
@ -37,8 +37,6 @@ export function createFirstLaunchTour() {
|
|||
|
||||
makeLinksOpenExternally(win);
|
||||
|
||||
if (PORTABLE && !existsSync(DATA_DIR)) mkdirSync(DATA_DIR);
|
||||
|
||||
win.loadFile(join(VIEW_DIR, "first-launch.html"));
|
||||
win.webContents.addListener("console-message", (_e, _l, msg) => {
|
||||
if (msg === "cancel") return app.exit();
|
||||
|
|
Reference in a new issue