mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 13:10:30 +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()
|
}).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()}"`
|
||||||
{
|
)
|
||||||
|
spawn('powershell', ['-File', `"${path.join(exeDir(), 'install.ps1')}"`], {
|
||||||
shell: true,
|
shell: true,
|
||||||
detached: true
|
detached: true
|
||||||
}
|
}).unref()
|
||||||
).unref()
|
|
||||||
app.quit()
|
app.quit()
|
||||||
}
|
}
|
||||||
if (file.endsWith('.dmg')) {
|
if (file.endsWith('.dmg')) {
|
||||||
|
|||||||
@ -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 {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user