MCPcopy
hub / github.com/ZToolsCenter/ZTools / startUpdate

Method startUpdate

src/main/api/updater.ts:454–475  ·  view source on GitHub ↗

* 开始更新(手动升级)

(updateInfo: any)

Source from the content-addressed store, hash-verified

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 窗口

Callers 2

setupIPCMethod · 0.95
setupIPCMethod · 0.80

Calls 3

getUpdatePathsMethod · 0.95
launchUpdaterMethod · 0.95

Tested by

no test coverage detected