Windows Portable: store settings in portable folder (#592)

Co-authored-by: MrGarlic <bsamans@samans.com>
Co-authored-by: vee <vendicated@riseup.net>
This commit is contained in:
MrGarlic1
2024-05-28 20:03:01 -04:00
committed by GitHub
parent b6c3c8024b
commit 3772db9eea
2 changed files with 16 additions and 9 deletions

View File

@@ -5,6 +5,7 @@
*/
import { app, BrowserWindow, shell } from "electron";
import { PORTABLE } from "main/constants";
import { Settings, State } from "main/settings";
import { handle } from "main/utils/ipcWrappers";
import { makeLinksOpenExternally } from "main/utils/makeLinksOpenExternally";
@@ -23,17 +24,12 @@ let updateData: UpdateData;
handle(IpcEvents.UPDATER_GET_DATA, () => updateData);
handle(IpcEvents.UPDATER_DOWNLOAD, () => {
const portable = !!process.env.PORTABLE_EXECUTABLE_FILE;
const { assets } = updateData.release;
const url = (() => {
switch (process.platform) {
case "win32":
return assets.find(a => {
if (!a.name.endsWith(".exe")) return false;
const isSetup = a.name.includes("Setup");
return portable ? !isSetup : isSetup;
return a.name.endsWith(PORTABLE ? "win.zip" : ".exe");
})!.browser_download_url;
case "darwin":
return assets.find(a =>