From 0ea63a78b416db4c09764f84152fae1728d2d4c8 Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Thu, 26 Sep 2024 13:21:21 +0800 Subject: [PATCH] fix portable updater --- src/main/resolve/autoUpdater.ts | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/main/resolve/autoUpdater.ts b/src/main/resolve/autoUpdater.ts index b59da54..e65a2b3 100644 --- a/src/main/resolve/autoUpdater.ts +++ b/src/main/resolve/autoUpdater.ts @@ -74,14 +74,17 @@ export async function downloadAndInstallUpdate(version: string): Promise { }).unref() } if (file.endsWith('.7z')) { - await writeFile( - path.join(exeDir(), 'install.ps1'), - `& "${path.join(resourcesFilesDir(), '7za.exe')}" x -o"${exeDir()}" -y "${path.join(dataDir(), file)}"; Start-Process -FilePath "${exePath()}"` - ) - spawn('powershell', ['-File', `"${path.join(exeDir(), 'install.ps1')}"`], { - shell: true, - detached: true - }).unref() + spawn( + 'cmd', + [ + '/C', + `""${path.join(resourcesFilesDir(), '7za.exe')}" x -o"${exeDir()}" -y "${path.join(dataDir(), file)}" & start "" "${exePath()}""` + ], + { + shell: true, + detached: true + } + ).unref() app.quit() } if (file.endsWith('.dmg')) {