fix portable update

This commit is contained in:
pompurin404 2024-10-15 14:00:12 +08:00
parent 710780456a
commit ee0a0b4867
No known key found for this signature in database
2 changed files with 4 additions and 2 deletions

View File

@ -7,3 +7,4 @@
### Bug Fixes
- 修复下拉菜单组件样式异常
- 修复便携版更新时文件占用的问题

View File

@ -3,7 +3,7 @@ import yaml from 'yaml'
import { app, shell } from 'electron'
import { getControledMihomoConfig } from '../config'
import { dataDir, exeDir, exePath, isPortable, resourcesFilesDir } from '../utils/dirs'
import { rm, writeFile } from 'fs/promises'
import { copyFile, rm, writeFile } from 'fs/promises'
import path from 'path'
import { existsSync } from 'fs'
import os from 'os'
@ -74,11 +74,12 @@ export async function downloadAndInstallUpdate(version: string): Promise<void> {
}).unref()
}
if (file.endsWith('.7z')) {
await copyFile(path.join(resourcesFilesDir(), '7za.exe'), path.join(dataDir(), '7za.exe'))
spawn(
'cmd',
[
'/C',
`""${path.join(resourcesFilesDir(), '7za.exe')}" x -o"${exeDir()}" -y "${path.join(dataDir(), file)}" & start "" "${exePath()}""`
`"timeout /t 2 /nobreak >nul && "${path.join(dataDir(), '7za.exe')}" x -o"${exeDir()}" -y "${path.join(dataDir(), file)}" & start "" "${exePath()}""`
],
{
shell: true,