feat(launcher): detect missing client folders and support relocating while keeping saves
This commit is contained in:
1 parent
2820d40d87
commit
a0515c4ed3
12 files changed
+199
-20
No files matched your search
@@ -6,13 +6,14 @@ import { listBackgroundPictures } from '../services/background-art/art-catalog.t
|
||||
import { getCopyTuning, updateCopyTuning } from '../services/config/copy-tuning.ts';
|
||||
import { getSettings, updateSettings } from '../services/config/settings-store.ts';
|
||||
import { cancelMaintenance, maintainCopy, maintenanceInfo, maintenanceInProgress } from '../services/copies/copy-maintenance.ts';
|
||||
import { relocateCopy } from '../services/copies/relocate-copy.ts';
|
||||
import { exportDiagnostics, openLogsFolder } from '../services/diagnostics/diagnostics.ts';
|
||||
import { measureFolder } from '../services/game-folder/folder-size.ts';
|
||||
import { inspectGameFolder, requireFolder } from '../services/game-folder/inspect-game-folder.ts';
|
||||
import { inspectPickedTargetFolder } from '../services/game-folder/inspect-target-folder.ts';
|
||||
import { changeDecalSource, decalImportInProgress } from '../services/install/decals.ts';
|
||||
import { cancelInstall, checkGameFolder, installGame, installationInProgress } from '../services/install/install-game.ts';
|
||||
import { canonicalCopyPath, createCopyDraft, listCopies, readInstallRecord, renameCopy, setCurrentCopy } from '../services/install/install-record.ts';
|
||||
import { canonicalCopyPath, copyFolderMissing, createCopyDraft, hydrateCopiesStatus, listCopies, readInstallRecord, renameCopy, setCurrentCopy } from '../services/install/install-record.ts';
|
||||
import { readInstalledLab } from '../services/launch/lab-handoff.ts';
|
||||
import { getLaunchState, launchInProgress, openServerStatus, startLaunch, stopLaunch } from '../services/launch/launch-controller.ts';
|
||||
import { activePatchSet, applyPackUpdate, checkPackUpdate, revertToBundledPatchSet } from '../services/patch-pack/pack-update.ts';
|
||||
@@ -84,38 +85,50 @@ export function registerIpcHandlers(): void {
|
||||
handle('install:start', async (request) => {
|
||||
if (maintenanceInProgress()) throw new AppError('maintenance_busy');
|
||||
const record = await installGame(request, (progress) => broadcast('event:install-progress', progress));
|
||||
broadcast('event:copies-changed', await listCopies());
|
||||
broadcast('event:copies-changed', await hydrateCopiesStatus(await listCopies()));
|
||||
return record;
|
||||
});
|
||||
handle('install:cancel', () => ({ cancelled: cancelInstall() }));
|
||||
handle('install:getRecord', async () => ({ record: await readInstallRecord() }));
|
||||
handle('install:getRecord', async () => {
|
||||
const record = await readInstallRecord();
|
||||
if (!record) return { record: null };
|
||||
return { record: (await copyFolderMissing(record.copyPath)) ? { ...record, folderMissing: true } : record };
|
||||
});
|
||||
handle('install:listFeatures', () => {
|
||||
const resources = resourcePaths();
|
||||
return patchFeatures(resources.patches).map((feature) => ({ ...feature, patchIds: [...feature.patchIds] }));
|
||||
});
|
||||
|
||||
handle('copies:list', () => listCopies());
|
||||
handle('copies:list', async () => hydrateCopiesStatus(await listCopies()));
|
||||
handle('copies:setCurrent', async ({ id }) => {
|
||||
const registry = await setCurrentCopy(id);
|
||||
const registry = await hydrateCopiesStatus(await setCurrentCopy(id));
|
||||
broadcast('event:copies-changed', registry);
|
||||
return registry;
|
||||
});
|
||||
handle('copies:rename', async ({ id, name }) => {
|
||||
const registry = await renameCopy(id, name);
|
||||
const registry = await hydrateCopiesStatus(await renameCopy(id, name));
|
||||
broadcast('event:copies-changed', registry);
|
||||
return registry;
|
||||
});
|
||||
handle('copies:relocate', async ({ id, path }) => {
|
||||
if (launchInProgress() || maintenanceInProgress() || installationInProgress() || saveWriteInProgress() || decalImportInProgress()) {
|
||||
throw new AppError('maintenance_busy');
|
||||
}
|
||||
const registry = await relocateCopy(id, path);
|
||||
broadcast('event:copies-changed', registry);
|
||||
return registry;
|
||||
});
|
||||
|
||||
handle('copies:setDecalSource', async ({ id, path }) => {
|
||||
if (launchInProgress() || maintenanceInProgress() || installationInProgress()) throw new AppError('maintenance_busy');
|
||||
const updated = await changeDecalSource(id, path);
|
||||
const updated = await hydrateCopiesStatus(await changeDecalSource(id, path));
|
||||
broadcast('event:copies-changed', updated);
|
||||
return updated;
|
||||
});
|
||||
handle('copies:maintenanceInfo', ({ id }) => maintenanceInfo(id));
|
||||
handle('copies:maintain', async (request) => {
|
||||
if (saveWriteInProgress() || decalImportInProgress()) throw new AppError('maintenance_busy');
|
||||
const updated = await maintainCopy(request, (progress) => broadcast('event:copy-maintenance', progress));
|
||||
const updated = await hydrateCopiesStatus(await maintainCopy(request, (progress) => broadcast('event:copy-maintenance', progress)));
|
||||
broadcast('event:copies-changed', updated);
|
||||
return updated;
|
||||
});
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
import { AppError } from '@shared/errors.ts';
|
||||
import type { Copies } from '@shared/schemas/install.ts';
|
||||
import { inspectGameFolder } from '../game-folder/inspect-game-folder.ts';
|
||||
import { hydrateCopiesStatus, relocateCopyRecord } from '../install/install-record.ts';
|
||||
import { backUpStockFiles } from '../install/stock-backup.ts';
|
||||
|
||||
/**
|
||||
* Re-point an existing registered client to its moved folder while keeping its id, name, saves,
|
||||
* and data folder intact.
|
||||
*/
|
||||
export async function relocateCopy(id: string, newPath: string): Promise<Copies> {
|
||||
const game = await inspectGameFolder(newPath);
|
||||
if (game.missingFiles.length) throw new AppError('not_a_game_folder', { path: newPath });
|
||||
if (game.needsStockSource) throw new AppError('stock_source_invalid');
|
||||
const stockBackupPath = await backUpStockFiles(game.resolvedPath);
|
||||
const updated = await relocateCopyRecord(id, {
|
||||
copyPath: newPath,
|
||||
stockBackupPath,
|
||||
gameVersion: game.version,
|
||||
});
|
||||
return hydrateCopiesStatus(updated);
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
import { randomUUID } from 'node:crypto';
|
||||
import { realpath } from 'node:fs/promises';
|
||||
import { access, realpath } from 'node:fs/promises';
|
||||
import { dirname, isAbsolute, join, relative, resolve, sep } from 'node:path';
|
||||
import { app } from 'electron';
|
||||
import { isInSteamLibrary } from '@wto/patcher';
|
||||
import { GAME_FILES, isInSteamLibrary } from '@wto/patcher';
|
||||
import { AppError } from '@shared/errors.ts';
|
||||
import { CopiesSchema, type Copies, type InstallRecord } from '@shared/schemas/install.ts';
|
||||
import { readJsonOr, writeJsonAtomic } from '../../util/atomic-json.ts';
|
||||
@@ -75,11 +75,72 @@ export function renameCopy(id: string, name: string): Promise<Copies> {
|
||||
return updateCopyRecord(id, (record) => ({ ...record, name }));
|
||||
}
|
||||
|
||||
export async function copyFolderMissing(copyPath: string): Promise<boolean> {
|
||||
for (const file of Object.values(GAME_FILES)) {
|
||||
try {
|
||||
await access(join(copyPath, file));
|
||||
} catch {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/** Attach live `folderMissing` status to each registered copy without modifying `copies.json`. */
|
||||
export async function hydrateCopiesStatus(registry: Copies): Promise<Copies> {
|
||||
const copies = await Promise.all(registry.copies.map(async (copy) => {
|
||||
const missing = await copyFolderMissing(copy.copyPath);
|
||||
const { folderMissing: _old, ...base } = copy;
|
||||
return missing ? { ...base, folderMissing: true } : base;
|
||||
}));
|
||||
return { ...registry, copies };
|
||||
}
|
||||
|
||||
export function relocateCopyRecord(
|
||||
id: string,
|
||||
next: { readonly copyPath: string; readonly stockBackupPath: string; readonly gameVersion: string | null },
|
||||
): Promise<Copies> {
|
||||
return changeRegistry(async (registry) => {
|
||||
const current = registry.copies.find((copy) => copy.id === id);
|
||||
if (!current) throw new AppError('copy_not_found');
|
||||
const resolvedCopy = await canonicalCopyPath(next.copyPath);
|
||||
const resolvedData = await canonicalCopyPath(current.dataPath);
|
||||
if (overlaps(resolvedCopy, resolvedData) && copyPathContains(next.stockBackupPath, resolvedData)) {
|
||||
throw new AppError('copy_location_in_use');
|
||||
}
|
||||
for (const existing of registry.copies) {
|
||||
if (existing.id === id) continue;
|
||||
const used = await Promise.all([canonicalCopyPath(existing.copyPath), canonicalCopyPath(existing.dataPath)]);
|
||||
if (used.some((other) => overlaps(resolvedCopy, other))) {
|
||||
throw new AppError('copy_location_in_use');
|
||||
}
|
||||
}
|
||||
return {
|
||||
...registry,
|
||||
copies: registry.copies.map((record) => {
|
||||
if (record.id !== id) return record;
|
||||
const { steamLibraryConfirmation: _staleSteam, folderMissing: _staleMissing, ...rest } = record;
|
||||
return {
|
||||
...rest,
|
||||
copyPath: next.copyPath,
|
||||
stockBackupPath: next.stockBackupPath,
|
||||
gameVersion: next.gameVersion,
|
||||
};
|
||||
}),
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
/** Serialize writes so switching, renaming and completing an installation preserve each other. */
|
||||
function changeRegistry(change: (registry: Copies) => Promise<Copies> | Copies): Promise<Copies> {
|
||||
const operation = pending.then(async () => {
|
||||
try {
|
||||
const updated = CopiesSchema.parse(await change(await readRegistry()));
|
||||
const next = await change(await readRegistry());
|
||||
const sanitized: Copies = {
|
||||
...next,
|
||||
copies: next.copies.map(({ folderMissing: _ignored, ...rest }) => rest),
|
||||
};
|
||||
const updated = CopiesSchema.parse(sanitized);
|
||||
await writeJsonAtomic(recordPath(), updated);
|
||||
return updated;
|
||||
} catch (error) {
|
||||
|
||||
@@ -72,10 +72,17 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
|
||||
const wizard = useInstallWizard({ onInstalled: () => setRoute(START_ROUTE) });
|
||||
|
||||
const backgrounds = useBackgrounds(record?.copyPath ?? null, settings, report);
|
||||
const backgrounds = useBackgrounds(record && !record.folderMissing ? record.copyPath : null, settings, report);
|
||||
|
||||
useEffect(() => ipcOn('event:settings-changed', setSettings), []);
|
||||
useEffect(() => ipcOn('event:copies-changed', setRegistry), []);
|
||||
useEffect(() => {
|
||||
const refreshCopies = (): void => {
|
||||
ipcInvoke('copies:list').then(setRegistry).catch(() => undefined);
|
||||
};
|
||||
window.addEventListener('focus', refreshCopies);
|
||||
return () => window.removeEventListener('focus', refreshCopies);
|
||||
}, []);
|
||||
useEffect(() => applyLanguage(resolveLanguage(settings.language, info.systemLocale)), [settings.language, info.systemLocale]);
|
||||
|
||||
useEffect(() => {
|
||||
@@ -106,12 +113,22 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
if (details) go({ page: 'copies', section: 'summary' });
|
||||
}).catch(report);
|
||||
};
|
||||
const relocateCopy = (id: string): void => {
|
||||
clearError();
|
||||
ipcInvoke('dialog:pickFolder', { title: t('copies.relocateDialogTitle') })
|
||||
.then(({ path }) => {
|
||||
if (!path) return;
|
||||
return ipcInvoke('copies:relocate', { id, path }).then(setRegistry);
|
||||
})
|
||||
.catch(report);
|
||||
};
|
||||
const perCopyStatus = ['version-changed', 'failed', 'port-busy', 'server-exited', 'game-exited'].includes(launch.phase);
|
||||
const launchStatus: LaunchState = perCopyStatus && launch.copyId && launch.copyId !== record?.id ? { phase: 'ready' } : launch;
|
||||
const home = homeBar(record, launchStatus, t, () => wizard.start('new'), {
|
||||
start: () => { ipcInvoke('launch:start').catch(report); },
|
||||
stop: () => { ipcInvoke('launch:stop').catch(report); },
|
||||
checkVersion: () => go({ page: 'copies', section: 'features' }),
|
||||
relocate: () => { if (record) relocateCopy(record.id); },
|
||||
});
|
||||
|
||||
const view = ((): View => {
|
||||
@@ -168,7 +185,16 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
if (route.copies === 'list') {
|
||||
return {
|
||||
side,
|
||||
main: <CopyList registry={registry} supportedVersions={supported} onSelect={selectCopy} onAdd={() => wizard.start('new')} onAddExisting={() => wizard.start('existing')} />,
|
||||
main: (
|
||||
<CopyList
|
||||
registry={registry}
|
||||
supportedVersions={supported}
|
||||
onSelect={selectCopy}
|
||||
onRelocate={relocateCopy}
|
||||
onAdd={() => wizard.start('new')}
|
||||
onAddExisting={() => wizard.start('existing')}
|
||||
/>
|
||||
),
|
||||
bar: home,
|
||||
};
|
||||
}
|
||||
@@ -192,7 +218,15 @@ export function App({ info, initialSettings, initialCopies }: AppProps) {
|
||||
}
|
||||
const main = route.copies === 'features'
|
||||
? <FeatureStatus record={record} supportedVersions={supported} onError={report} />
|
||||
: <CopySummary record={record} supportedVersions={supported} onShowFeatures={() => go({ page: 'copies', section: 'features' })} onError={report} />;
|
||||
: (
|
||||
<CopySummary
|
||||
record={record}
|
||||
supportedVersions={supported}
|
||||
onShowFeatures={() => go({ page: 'copies', section: 'features' })}
|
||||
onRelocate={() => relocateCopy(record.id)}
|
||||
onError={report}
|
||||
/>
|
||||
);
|
||||
return { side, main, bar: home };
|
||||
}
|
||||
}
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
"ready": "Ready",
|
||||
"readyMissing": "Ready · {{count}} features unavailable",
|
||||
"readyDetail": "Game {{version}}",
|
||||
"missingFolder": "Client folder not found",
|
||||
"launch": "Launch"
|
||||
},
|
||||
"launch": {
|
||||
@@ -215,6 +216,9 @@
|
||||
},
|
||||
"add": "Add a client",
|
||||
"addExisting": "Add existing client",
|
||||
"missingFolder": "Folder missing",
|
||||
"relocate": "Relocate…",
|
||||
"relocateDialogTitle": "Select the moved client folder",
|
||||
"list": { "current": "Current", "select": "Set as current" },
|
||||
"none": "The offline edition is not installed yet.",
|
||||
"maintenance": {
|
||||
@@ -267,6 +271,7 @@
|
||||
"adaptation": "Check status",
|
||||
"adaptationHint": "Whether every patch was checked on this game version and verified in game",
|
||||
"location": "Location",
|
||||
"missingHint": "Game files were not found at this path. Relocate to the moved folder to keep existing saves and tuning.",
|
||||
"method": "Installation type",
|
||||
"methods": {
|
||||
"copy": "Copy installation",
|
||||
|
||||
@@ -67,6 +67,7 @@
|
||||
"ready": "就绪",
|
||||
"readyMissing": "就绪 · {{count}} 项功能不可用",
|
||||
"readyDetail": "游戏 {{version}}",
|
||||
"missingFolder": "客户端目录不存在",
|
||||
"launch": "启动"
|
||||
},
|
||||
"launch": {
|
||||
@@ -215,6 +216,9 @@
|
||||
},
|
||||
"add": "添加客户端",
|
||||
"addExisting": "添加已有客户端",
|
||||
"missingFolder": "目录不存在",
|
||||
"relocate": "重新定位…",
|
||||
"relocateDialogTitle": "选择挪动后的客户端文件夹",
|
||||
"list": { "current": "当前", "select": "设为当前" },
|
||||
"none": "尚未安装离线版。",
|
||||
"maintenance": {
|
||||
@@ -267,6 +271,7 @@
|
||||
"adaptation": "核对状态",
|
||||
"adaptationHint": "这个游戏版本是否检查过全部补丁并在游戏里验证过",
|
||||
"location": "位置",
|
||||
"missingHint": "未在原位置找到游戏文件。可重新定位至挪动后的文件夹,保留现有存档和数值。",
|
||||
"method": "安装方式",
|
||||
"methods": {
|
||||
"copy": "复制安装",
|
||||
|
||||
@@ -7,11 +7,12 @@ interface CopyListProps {
|
||||
readonly registry: Copies;
|
||||
readonly supportedVersions: readonly string[];
|
||||
readonly onSelect: (id: string, detail?: boolean) => void;
|
||||
readonly onRelocate: (id: string) => void;
|
||||
readonly onAdd: () => void;
|
||||
readonly onAddExisting: () => void;
|
||||
}
|
||||
|
||||
export function CopyList({ registry, supportedVersions, onSelect, onAdd, onAddExisting }: CopyListProps) {
|
||||
export function CopyList({ registry, supportedVersions, onSelect, onRelocate, onAdd, onAddExisting }: CopyListProps) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Sheet title={t('copies.sections.list')}>
|
||||
@@ -25,6 +26,7 @@ export function CopyList({ registry, supportedVersions, onSelect, onAdd, onAddEx
|
||||
<div className="copy-list-heading">
|
||||
<strong>{copy.name}</strong>
|
||||
{current && <span className="ok">{t('copies.list.current')}</span>}
|
||||
{copy.folderMissing && <span className="warn">{t('copies.missingFolder')}</span>}
|
||||
</div>
|
||||
<dl className="kv">
|
||||
<dt>{t('copies.summary.version')}</dt>
|
||||
@@ -39,7 +41,14 @@ export function CopyList({ registry, supportedVersions, onSelect, onAdd, onAddEx
|
||||
<dd className="folder-path" data-ellipsis-tip={copy.copyPath}>{copy.copyPath}</dd>
|
||||
</dl>
|
||||
<div className="copy-list-actions">
|
||||
{!current && <button type="button" className="button button-primary" onClick={() => onSelect(copy.id)}>{t('copies.list.select')}</button>}
|
||||
{copy.folderMissing && (
|
||||
<button type="button" className="button button-primary" onClick={() => onRelocate(copy.id)}>{t('copies.relocate')}</button>
|
||||
)}
|
||||
{!current && (
|
||||
<button type="button" className={copy.folderMissing ? 'button' : 'button button-primary'} onClick={() => onSelect(copy.id)}>
|
||||
{t('copies.list.select')}
|
||||
</button>
|
||||
)}
|
||||
<button type="button" className="button" onClick={() => onSelect(copy.id, true)}>{t('side.details')}</button>
|
||||
</div>
|
||||
</article>
|
||||
|
||||
@@ -11,11 +11,12 @@ interface CopySummaryProps {
|
||||
readonly record: InstallRecord;
|
||||
readonly supportedVersions: readonly string[];
|
||||
readonly onShowFeatures: () => void;
|
||||
readonly onRelocate: () => void;
|
||||
readonly onError: (error: unknown) => void;
|
||||
}
|
||||
|
||||
/** What is installed where: version, adaptation, folders, installation type. */
|
||||
export function CopySummary({ record, supportedVersions, onShowFeatures, onError }: CopySummaryProps) {
|
||||
export function CopySummary({ record, supportedVersions, onShowFeatures, onRelocate, onError }: CopySummaryProps) {
|
||||
const { t, i18n } = useTranslation();
|
||||
const [name, setName] = useState(record.name);
|
||||
const [importing, setImporting] = useState(false);
|
||||
@@ -52,7 +53,18 @@ export function CopySummary({ record, supportedVersions, onShowFeatures, onError
|
||||
<Row label={t('copies.summary.adaptation')} hint={t('copies.summary.adaptationHint')}>
|
||||
<span className={verified ? 'ok' : 'warn'}>{verified ? t('adaptation.verified') : t('adaptation.unverified')}</span>
|
||||
</Row>
|
||||
<Row label={t('copies.summary.location')}>{folder(record.copyPath)}</Row>
|
||||
<Row label={t('copies.summary.location')} hint={record.folderMissing ? t('copies.summary.missingHint') : undefined}>
|
||||
<span className="folder-path" data-ellipsis-tip={record.copyPath}>{record.copyPath}</span>
|
||||
{record.folderMissing && <span className="warn">{t('copies.missingFolder')}</span>}
|
||||
<button type="button" className={record.folderMissing ? 'button button-primary' : 'button'} onClick={onRelocate}>
|
||||
{t('copies.relocate')}
|
||||
</button>
|
||||
{!record.folderMissing && (
|
||||
<button type="button" className="button" onClick={() => ipcInvoke('app:openFolder', { path: record.copyPath }).catch(onError)}>
|
||||
{t('copies.summary.open')}
|
||||
</button>
|
||||
)}
|
||||
</Row>
|
||||
<Row label={t('copies.summary.method')}>{t(`copies.summary.methods.${record.hardlinkedFiles?.length ? 'hardlink' : record.method}`)}</Row>
|
||||
{record.sourcePath && <Row label={t('copies.summary.source')}>{folder(record.sourcePath)}</Row>}
|
||||
<Row label={t('copies.summary.stock')} hint={t('copies.summary.stockHint')}>{folder(record.stockBackupPath)}</Row>
|
||||
|
||||
@@ -39,7 +39,10 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele
|
||||
<>
|
||||
<h3 className="side-heading">{t('side.currentCopy')}</h3>
|
||||
<button type="button" className="copy-card copy-card-button" aria-expanded={choosingCopy} onClick={() => setChoosingCopy(!choosingCopy)}>
|
||||
<span className="copy-card-name">{record.name}</span>
|
||||
<span className="copy-card-name">
|
||||
{record.name}
|
||||
{record.folderMissing && <> · <span className="warn">{t('copies.missingFolder')}</span></>}
|
||||
</span>
|
||||
<span className="copy-card-meta" data-ellipsis-tip={`${record.gameVersion ?? t('source.versionUnknown')} · ${record.copyPath}`}>
|
||||
{record.gameVersion ?? t('source.versionUnknown')} · {record.copyPath}
|
||||
</span>
|
||||
@@ -51,7 +54,7 @@ export function HomeSide({ record, copies, supportedVersions, onNavigate, onSele
|
||||
setChoosingCopy(false);
|
||||
onSelectCopy(copy.id);
|
||||
}}>
|
||||
{copy.name} · {copy.gameVersion ?? t('source.versionUnknown')}
|
||||
{copy.name} · {copy.folderMissing ? t('copies.missingFolder') : (copy.gameVersion ?? t('source.versionUnknown'))}
|
||||
</button>
|
||||
))}
|
||||
</div>
|
||||
|
||||
@@ -8,6 +8,7 @@ interface LaunchActions {
|
||||
readonly start: () => void;
|
||||
readonly stop: () => void;
|
||||
readonly checkVersion: () => void;
|
||||
readonly relocate: () => void;
|
||||
}
|
||||
|
||||
/** The installation and launch actions shown outside the wizard. */
|
||||
@@ -90,6 +91,14 @@ export function homeBar(
|
||||
primary: { label: t('bar.install'), onClick: onInstall },
|
||||
};
|
||||
}
|
||||
if (record.folderMissing) {
|
||||
return {
|
||||
tone: 'bad',
|
||||
title: t('bar.missingFolder'),
|
||||
detail: record.copyPath,
|
||||
primary: { label: t('copies.relocate'), onClick: actions.relocate },
|
||||
};
|
||||
}
|
||||
const missing = missingFeatures(record).length;
|
||||
return {
|
||||
tone: missing ? 'warn' : 'ok',
|
||||
|
||||
@@ -132,6 +132,10 @@ export const ipcContract = {
|
||||
input: z.object({ id: CopyIdSchema, name: CopyNameSchema }),
|
||||
output: CopiesSchema,
|
||||
},
|
||||
'copies:relocate': {
|
||||
input: z.object({ id: CopyIdSchema, path: z.string().min(1) }),
|
||||
output: CopiesSchema,
|
||||
},
|
||||
'copies:setDecalSource': {
|
||||
input: z.object({ id: CopyIdSchema, path: z.string().min(1).nullable() }),
|
||||
output: CopiesSchema,
|
||||
|
||||
@@ -164,6 +164,8 @@ export const InstallRecordSchema = z.object({
|
||||
sourceFiles: z.array(z.string().min(1)).optional(),
|
||||
/** Relative resource paths linked to the source and detached on a version update. */
|
||||
hardlinkedFiles: z.array(z.string().min(1)).optional(),
|
||||
/** Runtime check hydrated when listing copies (never persisted to copies.json): true if copyPath or core game files are missing on disk. */
|
||||
folderMissing: z.boolean().optional(),
|
||||
});
|
||||
export type InstallRecord = z.output<typeof InstallRecordSchema>;
|
||||
|
||||
|
||||
Reference in new issue
Block a user