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()
}
if (file.endsWith('.7z')) {
spawn(
path.join(resourcesFilesDir(), '7za.exe'),
['x', `-o"${exeDir()}"`, '-y', path.join(dataDir(), file)],
{
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()
}).unref()
app.quit()
}
if (file.endsWith('.dmg')) {

View File

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