fix(launcher): use original-fs for copy and guard nested launcher folders

Electron patches node:fs to treat any .asar file on disk as a virtual
archive directory. When a player's War Thunder source directory contains
an .asar file (for example from a leftover portable launcher folder
previously unpacked inside the game folder), createReadStream fails with
ENOENT and aborts full-copy installation.

Changes:
- Add rawFs() helper using Electron's original-fs (with node:fs fallback)
  and use it across copy-game.ts and change-copy-files.ts for directory
  scans, streaming copies, timestamp preservation, rollback and cleanup.
- Preserve the first non-cancellation worker error in copyPlannedFiles so
  sibling AbortError rejections do not mask the real filesystem or
  hardlink error.
- Skip nested subfolders containing WTOffline Launcher.exe during
  planCopy, and reject copy installation upfront with
  launcher_inside_source when the packaged launcher itself runs from
  inside the selected source game directory (with en and zh-CN messages).

Verification:
- Root and launcher typecheck passed.
- Launcher electron-vite build passed.
- en.json and zh-CN.json key parity check passed (720 keys).
- Verified in Electron that patched node:fs reproduces ENOENT on
  default_app.asar while original-fs copies and cleans it up cleanly.
- Packaged installer end-to-end verification pending.
This commit is contained in:
N0VAN0M4LY committed 2026-12-03 10:40:49 +08:00
1 parent 01bafb6db7
commit e2ac4fa744
7 files changed
+80 -23

No files matched your search

+2
View File
@@ -94,6 +94,8 @@ export const APP_ERROR_CODES = [
'missing_features_not_accepted',
/** Working out which patches fit failed; the details are in the log. */
'patch_check_failed',
/** The packaged launcher itself sits inside the selected stock War Thunder folder. */
'launcher_inside_source',
/** Copying the game failed; what was copied has been removed. */
'copy_failed',
'hardlink_unavailable',