fix(launcher): detect stale stock backups and distinguish missing backups on launch

Read the live executable version in inspectGameFolder instead of masking externally updated folders behind an older wtoffline/stock backup, and atomically refresh stale or unreadable backups during install, external stock import, and relocation. Log exact copy/stock/recorded versions on launch mismatches and report a dedicated launch_stock_missing error when wtoffline/stock/win64/aces.exe is missing or unreadable.

Checked: root typecheck, launcher typecheck, zh-CN/en locale key parity (616/616), and launcher electron-vite build.
This commit is contained in:
N0VAN0M4LY committed 2026-12-02 09:06:28 +08:00
1 parent f3d04d137f
commit c55ec4ed57
8 files changed
+67 -22

No files matched your search

@@ -144,6 +144,10 @@ async function planLaunch(job: LaunchJob, record: InstallRecord, settings: Setti
}
const currentVersion = await readVersion(record.copyPath, signal);
if (!currentVersion || currentVersion !== record.gameVersion) {
console.warn(
`[launch] client version changed: recorded=${record.gameVersion ?? 'unknown'}, ` +
`actual=${currentVersion ?? 'missing'} (${record.copyPath})`,
);
update(job, { phase: 'version-changed', actualVersion: currentVersion });
return null;
}
@@ -171,6 +175,11 @@ async function planLaunch(job: LaunchJob, record: InstallRecord, settings: Setti
]);
signal.throwIfAborted();
if (!copyVersion || copyVersion !== stockVersion) {
console.warn(
`[launch] copy/stock version mismatch: copy=${copyVersion ?? 'missing'} (${copyPath}), ` +
`stock=${stockVersion ?? 'missing'} (${stockPath})`,
);
if (!lab && !stockVersion) throw new AppError('launch_stock_missing');
throw new AppError(lab ? 'launch_lab_version' : 'launch_stock_version');
}
if (games) throw new AppError('launch_game_running');