mirror of
https://github.com/pompurin404/mihomo-party.git
synced 2024-11-16 11:42:19 +08:00
fix portable updater
This commit is contained in:
parent
a1e8a37147
commit
fc0c34d974
|
@ -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')) {
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Reference in New Issue
Block a user