fix portable updater

This commit is contained in:
pompurin404 2024-09-24 19:57:49 +08:00
parent a1e8a37147
commit fc0c34d974
No known key found for this signature in database
2 changed files with 9 additions and 9 deletions

View File

@ -74,14 +74,14 @@ export async function downloadAndInstallUpdate(version: string): Promise<void> {
}).unref() }).unref()
} }
if (file.endsWith('.7z')) { if (file.endsWith('.7z')) {
spawn( await writeFile(
path.join(resourcesFilesDir(), '7za.exe'), path.join(exeDir(), 'install.ps1'),
['x', `-o"${exeDir()}"`, '-y', path.join(dataDir(), file)], `& "${path.join(resourcesFilesDir(), '7za.exe')}" x -o"${exeDir()}" -y "${path.join(dataDir(), file)}"; Start-Process -FilePath "${exePath()}"`
{ )
shell: true, spawn('powershell', ['-File', `"${path.join(exeDir(), 'install.ps1')}"`], {
detached: true shell: true,
} detached: true
).unref() }).unref()
app.quit() app.quit()
} }
if (file.endsWith('.dmg')) { if (file.endsWith('.dmg')) {

View File

@ -105,7 +105,7 @@ async function cleanup(): Promise<void> {
// update cache // update cache
const files = await readdir(dataDir()) const files = await readdir(dataDir())
for (const file of files) { for (const file of files) {
if (file.endsWith('.exe') || file.endsWith('.dmg')) { if (file.endsWith('.exe') || file.endsWith('.dmg') || file.endsWith('.7z')) {
try { try {
await rm(path.join(dataDir(), file)) await rm(path.join(dataDir(), file))
} catch { } catch {