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:
1 parent
84158f719d
commit
5a78b1fdf8
28 files changed
+813
-459
No files matched your search
@@ -0,0 +1,18 @@
|
||||
import { readdir } from 'node:fs/promises';
|
||||
import { join } from 'node:path';
|
||||
import { AppError } from '@shared/errors.ts';
|
||||
|
||||
/** A data tree must keep the server's saves, logs and caches inside the selected folder. */
|
||||
export async function requireUnredirectedData(root: string): Promise<void> {
|
||||
const folders = [root];
|
||||
for (let folder = folders.pop(); folder !== undefined; folder = folders.pop()) {
|
||||
const entries = await readdir(folder, { withFileTypes: true }).catch((error: NodeJS.ErrnoException) => {
|
||||
if (folder === root && error.code === 'ENOENT') return [];
|
||||
throw error;
|
||||
});
|
||||
for (const entry of entries) {
|
||||
if (entry.isSymbolicLink()) throw new AppError('launch_location');
|
||||
if (entry.isDirectory()) folders.push(join(folder, entry.name));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user