fix(copies): honor confirmed Steam locations

Bind confirmation to the selected copy and data paths throughout installation, launch, and maintenance. Validate redirected runtime data paths and recheck original files before refreshing an in-place backup.

Verified by type checking and build. The acceptance checklist covers directory links and Steam confirmation.
This commit is contained in:
N0VAN0M4LY committed 2026-11-30 15:23:17 +08:00
1 parent 84158f719d
commit 5a78b1fdf8
28 files changed
+813 -459

No files matched your search

+3 -3
View File
@@ -26,14 +26,14 @@ export function assertWritableCopy(stockFolder: string, copyFolder: string, opti
const stock = canonical(stockFolder);
const copy = canonical(copyFolder);
if (copy === stock) throw new Error('the output folder is the folder the stock files are read from');
if (isInSteamLibrary(copy) && !options.steamLibraryConfirmed) {
if (isInSteamLibrary(copyFolder) && !options.steamLibraryConfirmed) {
throw new Error(`refusing to write into a Steam library without the player's confirmation: ${copy}`);
}
}
/** Whether a folder lies inside a Steam library (a `steamapps` folder on its path). */
/** A Steam-managed path can use a junction to store its files outside the library. */
export function isInSteamLibrary(folder: string): boolean {
return canonical(folder).toLowerCase().split(sep).includes('steamapps');
return [resolve(folder), canonical(folder)].some((path) => path.toLowerCase().split(sep).includes('steamapps'));
}
function canonical(folder: string): string {