* 开始更新(手动升级)
(updateInfo: any)
| 452 | * 开始更新(手动升级) |
| 453 | */ |
| 454 | public async startUpdate(updateInfo: any): Promise<any> { |
| 455 | try { |
| 456 | console.log('[Updater] 开始更新流程...', updateInfo) |
| 457 | |
| 458 | // 1. 下载并解压更新包 |
| 459 | const downloadResult = await this.downloadAndExtractUpdate(updateInfo) |
| 460 | if (!downloadResult.success) { |
| 461 | return downloadResult |
| 462 | } |
| 463 | |
| 464 | // 2. 获取更新路径配置 |
| 465 | const paths = await this.getUpdatePaths(downloadResult.extractPath) |
| 466 | |
| 467 | // 3. 启动 updater 并退出应用 |
| 468 | await this.launchUpdater(paths) |
| 469 | |
| 470 | return { success: true } |
| 471 | } catch (error: unknown) { |
| 472 | console.error('[Updater] 更新流程失败:', error) |
| 473 | return { success: false, error: error instanceof Error ? error.message : '未知错误' } |
| 474 | } |
| 475 | } |
| 476 | |
| 477 | /** |
| 478 | * 应用窗口材质到 Update 窗口 |
no test coverage detected