diff --git a/src/main/constants.ts b/src/main/constants.ts index b19e95d..6417efc 100644 --- a/src/main/constants.ts +++ b/src/main/constants.ts @@ -8,12 +8,12 @@ import { app } from "electron"; import { existsSync, readdirSync, renameSync, rmdirSync } from "fs"; import { join, resolve } from "path"; -const vesktopDir = resolve("..", "..", "..", "..", __dirname); +const vesktopDir = resolve(__dirname, "..", "..", "..", ".."); export const PORTABLE = process.platform === "win32" && !readdirSync(vesktopDir).includes("Uninstall Vesktop.exe"); const LEGACY_DATA_DIR = join(app.getPath("appData"), "VencordDesktop", "VencordDesktop"); export const DATA_DIR = PORTABLE - ? resolve(vesktopDir + "Data") + ? join(vesktopDir, "Data") : process.env.VENCORD_USER_DATA_DIR || join(app.getPath("userData")); // TODO: remove eventually diff --git a/src/main/firstLaunch.ts b/src/main/firstLaunch.ts index d1bbceb..870f0c4 100644 --- a/src/main/firstLaunch.ts +++ b/src/main/firstLaunch.ts @@ -6,13 +6,13 @@ import { app } from "electron"; import { BrowserWindow } from "electron/main"; -import { copyFileSync, mkdirSync, readdirSync } from "fs"; +import { copyFileSync, mkdirSync, readdirSync, existsSync } from "fs"; import { join } from "path"; import { SplashProps } from "shared/browserWinProperties"; import { ICON_PATH, VIEW_DIR } from "shared/paths"; import { autoStart } from "./autoStart"; -import { DATA_DIR } from "./constants"; +import { DATA_DIR, PORTABLE } from "./constants"; import { createWindows } from "./mainWindow"; import { Settings, State } from "./settings"; import { makeLinksOpenExternally } from "./utils/makeLinksOpenExternally"; @@ -37,6 +37,8 @@ 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(); diff --git a/src/updater/main.ts b/src/updater/main.ts index a8f45fb..8638672 100644 --- a/src/updater/main.ts +++ b/src/updater/main.ts @@ -28,11 +28,10 @@ handle(IpcEvents.UPDATER_DOWNLOAD, () => { const url = (() => { switch (process.platform) { case "win32": + console.log(assets); return assets.find(a => { - if (!a.name.endsWith(".exe")) return false; - - const isSetup = a.name.includes("Setup"); - return PORTABLE ? !isSetup : isSetup; + if (PORTABLE && a.name.endsWith("win.zip")) return true; + if (!PORTABLE && a.name.endsWith(".exe")) return true; })!.browser_download_url; case "darwin": return assets.find(a =>