feat(launcher): auto-detect decal cache from selected or recorded game folder
Extend resolvePlayerDecalCacheFolder to resolve <game>/cache/content when the player picks a game root folder directly. Add read-only decals:detectSource IPC so the install wizard auto-fills a detected decal cache from the chosen source (with one-click reset to placeholders) and the client details view offers one-click import from the recorded online sourcePath.
This commit is contained in:
1 parent
49264b0326
commit
c3cf4e3707
12 files changed
+196
-31
No files matched your search
@@ -22,6 +22,25 @@ export function decalCachePath(dataPath: string, cacheId: string): string {
|
||||
return join(dataPath, CACHE_FOLDER, cacheId);
|
||||
}
|
||||
|
||||
/**
|
||||
* Read-only check whether a player-chosen or registered folder contains a usable decal cache
|
||||
* (<game>, <game>/cache, or <game>/cache/content). Returns the canonical cache/content path when
|
||||
* valid, or null when absent, invalid, or unreadable.
|
||||
*/
|
||||
export async function detectDecalCacheSource(folderPath: string): Promise<string | null> {
|
||||
if (!folderPath || !isAbsolute(folderPath)) return null;
|
||||
try {
|
||||
const rawSource = await realpath(folderPath).catch(() => null);
|
||||
if (!rawSource) return null;
|
||||
const resolved = resolvePlayerDecalCacheFolder(rawSource);
|
||||
const canonical = await realpath(resolved).catch(() => null);
|
||||
if (!canonical) return null;
|
||||
return playerDecalCacheProblem(canonical) === undefined ? canonical : null;
|
||||
} catch {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
async function cacheRoot(dataPath: string, steamDataConfirmed: boolean): Promise<string> {
|
||||
if (!isAbsolute(dataPath)) throw new AppError('decal_import_failed');
|
||||
const data = await canonicalCopyPath(dataPath);
|
||||
|
||||
Reference in new issue
Block a user