From c65e9c4f2c23475b5f8aa5560976dcffb0d922e8 Mon Sep 17 00:00:00 2001 From: MrGarlic Date: Fri, 10 May 2024 15:22:38 -0400 Subject: [PATCH] fixed portable check for unpackaged --- src/main/constants.ts | 9 +++++++-- src/main/firstLaunch.ts | 2 -- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/main/constants.ts b/src/main/constants.ts index 6045f40..9eef817 100644 --- a/src/main/constants.ts +++ b/src/main/constants.ts @@ -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)) { diff --git a/src/main/firstLaunch.ts b/src/main/firstLaunch.ts index 68c104c..cf0ec61 100644 --- a/src/main/firstLaunch.ts +++ b/src/main/firstLaunch.ts @@ -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();