feat(copies): add verified space-saving copies
Offer same-volume hard links for sampled 2.61.0.43 resources after checking their content and keeping mutable files independent. Support converting existing copies and detach registered links during version updates.
This commit is contained in:
1 parent
0881d62766
commit
2a97b0d46c
22 files changed
+3118
-111
No files matched your search
@@ -123,6 +123,11 @@
|
||||
"method": {
|
||||
"copy": "Copy installation (recommended)",
|
||||
"copyBody": "Copies the game to a new folder. Requires about {{size}} of free space.",
|
||||
"spaceSaving": "Space-saving copy",
|
||||
"spaceSavingBody": "Shares verified large resources on the same volume. Estimated space required is {{size}}. A Steam update in place can change shared files in the copy.",
|
||||
"spaceSavingPending": "Calculating how much space can be saved.",
|
||||
"spaceSavingUnavailable": "This installation has no large resources eligible for space-saving copying.",
|
||||
"sameVolumeRequired": "Select a destination on the same volume as the original installation.",
|
||||
"targetTitle": "Select a folder for the copy",
|
||||
"inPlace": "In-place installation",
|
||||
"inPlaceBody": "Uses the selected game folder as the copy. Original files are backed up to wtoffline\\stock, and patches are applied on first launch.",
|
||||
@@ -156,11 +161,14 @@
|
||||
"phase": {
|
||||
"checking": "Checking game files",
|
||||
"measuring": "Counting files",
|
||||
"verifying": "Verifying resources to share",
|
||||
"copying": "Copying game files",
|
||||
"backing-up": "Backing up original files",
|
||||
"recording": "Finishing installation"
|
||||
},
|
||||
"copied": "Copied {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} files",
|
||||
"verified": "Verified {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} files",
|
||||
"prepared": "Prepared {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} files",
|
||||
"cancelHint": "Can be cancelled at any time; copied files will be deleted",
|
||||
"cancel": "Cancel installation",
|
||||
"cancelling": "Cancelling…"
|
||||
@@ -179,8 +187,13 @@
|
||||
"update": "Update from official installation",
|
||||
"updateAction": "Update copy",
|
||||
"newVersion": "Version {{version}} is available from the installation source.",
|
||||
"updateDetaches": "Version {{version}} is available. Updating copies shared resources into independent files and requires additional space.",
|
||||
"currentVersion": "Installation source version {{version}}",
|
||||
"noSource": "Installation source unavailable",
|
||||
"spaceSaving": "Save space",
|
||||
"spaceSavingHint": "Share identical verified resources with the source. A Steam update in place can change the shared files.",
|
||||
"spaceSavingUnavailable": "Requires a copy and source installation of the same checked version on the same volume.",
|
||||
"compactAction": "Convert",
|
||||
"check": "Recheck patches",
|
||||
"checkHint": "Check the original file backup.",
|
||||
"lastCheck": "Last checked {{date}}",
|
||||
@@ -202,8 +215,9 @@
|
||||
"check": "Patch check complete.",
|
||||
"repair": "Original files restored.",
|
||||
"update": "Copy updated.",
|
||||
"compact": "Space-saving conversion complete.",
|
||||
"delete": "Copy deleted.",
|
||||
"cancelled": "Update cancelled."
|
||||
"cancelled": "Maintenance cancelled."
|
||||
}
|
||||
},
|
||||
"summary": {
|
||||
@@ -217,6 +231,7 @@
|
||||
"method": "Installation type",
|
||||
"methods": {
|
||||
"copy": "Copy installation",
|
||||
"hardlink": "Space-saving copy",
|
||||
"in-place": "In-place installation"
|
||||
},
|
||||
"stock": "Original file backup",
|
||||
@@ -602,6 +617,9 @@
|
||||
"missing_features_not_accepted": "Some patches do not apply. Confirm whether to continue without the affected features.",
|
||||
"patch_check_failed": "An error occurred while checking patches.",
|
||||
"copy_failed": "Copying the game files failed. The copied files have been deleted.",
|
||||
"hardlink_unavailable": "Space-saving copying requires a verified game version and a destination on the same volume.",
|
||||
"hardlink_no_match": "The files do not match the verified resources for space-saving copying.",
|
||||
"hardlink_file_changed": "A resource changed during verification or copying. Finish any other file operation, then retry.",
|
||||
"install_cancelled": "Installation cancelled. The copied files have been deleted.",
|
||||
"install_busy": "An installation is already in progress.",
|
||||
"unknown": "An unknown error occurred."
|
||||
|
||||
@@ -123,6 +123,11 @@
|
||||
"method": {
|
||||
"copy": "复制安装(推荐)",
|
||||
"copyBody": "将游戏复制到新文件夹。需要约 {{size}} 的可用空间。",
|
||||
"spaceSaving": "节省空间的复制",
|
||||
"spaceSavingBody": "与同一磁盘卷上的原版共用已核对的大资源,预计需要 {{size}}。Steam 就地更新可能改变副本中的共享文件。",
|
||||
"spaceSavingPending": "正在估算可节省的空间。",
|
||||
"spaceSavingUnavailable": "该安装目录没有可用于省空间复制的大型资源。",
|
||||
"sameVolumeRequired": "请选择与原版位于同一磁盘卷的目标文件夹。",
|
||||
"targetTitle": "选择存放副本的文件夹",
|
||||
"inPlace": "原位安装",
|
||||
"inPlaceBody": "使用所选游戏文件夹作为副本。原版文件备份至 wtoffline\\stock,首次启动时将应用补丁。",
|
||||
@@ -156,11 +161,14 @@
|
||||
"phase": {
|
||||
"checking": "检查游戏文件",
|
||||
"measuring": "统计文件",
|
||||
"verifying": "核对可共用的资源",
|
||||
"copying": "复制游戏文件",
|
||||
"backing-up": "备份原版文件",
|
||||
"recording": "完成安装"
|
||||
},
|
||||
"copied": "已复制 {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} 个文件",
|
||||
"verified": "已核对 {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} 个文件",
|
||||
"prepared": "已处理 {{done}} / {{total}} · {{doneFiles}} / {{totalFiles}} 个文件",
|
||||
"cancelHint": "可随时取消,已复制的文件将被删除",
|
||||
"cancel": "取消安装",
|
||||
"cancelling": "正在取消…"
|
||||
@@ -179,8 +187,13 @@
|
||||
"update": "从正版更新",
|
||||
"updateAction": "更新副本",
|
||||
"newVersion": "安装来源已更新至 {{version}}。",
|
||||
"updateDetaches": "安装来源中有新版本 {{version}}。更新会把共享资源复制为独立文件,需要额外空间。",
|
||||
"currentVersion": "安装来源版本 {{version}}",
|
||||
"noSource": "安装来源不可用",
|
||||
"spaceSaving": "节省空间",
|
||||
"spaceSavingHint": "将内容一致且已核对的资源与原版共用。Steam 就地更新可能改变这些文件。",
|
||||
"spaceSavingUnavailable": "副本和安装来源须位于同一磁盘卷,并且使用相同的已核对版本。",
|
||||
"compactAction": "转换",
|
||||
"check": "重新检查补丁",
|
||||
"checkHint": "核对原版文件备份。",
|
||||
"lastCheck": "上次检查 {{date}}",
|
||||
@@ -202,8 +215,9 @@
|
||||
"check": "补丁检查已完成。",
|
||||
"repair": "原版文件已还原。",
|
||||
"update": "副本已更新。",
|
||||
"compact": "省空间转换已完成。",
|
||||
"delete": "副本已删除。",
|
||||
"cancelled": "更新已取消。"
|
||||
"cancelled": "维护已取消。"
|
||||
}
|
||||
},
|
||||
"summary": {
|
||||
@@ -217,6 +231,7 @@
|
||||
"method": "安装方式",
|
||||
"methods": {
|
||||
"copy": "复制安装",
|
||||
"hardlink": "节省空间的复制",
|
||||
"in-place": "原位安装"
|
||||
},
|
||||
"stock": "原版文件备份",
|
||||
@@ -602,6 +617,9 @@
|
||||
"missing_features_not_accepted": "部分补丁不适用,请先确认是否在缺少相应功能的情况下继续。",
|
||||
"patch_check_failed": "检查补丁时出错。",
|
||||
"copy_failed": "复制游戏文件失败,已复制的文件已删除。",
|
||||
"hardlink_unavailable": "省空间复制需要已核对的游戏版本,并且目标与原版位于同一磁盘卷。",
|
||||
"hardlink_no_match": "文件内容与可共用的实测资源不一致。",
|
||||
"hardlink_file_changed": "核对或复制过程中有资源文件发生变化。请等待其他文件操作完成后重试。",
|
||||
"install_cancelled": "安装已取消,已复制的文件已删除。",
|
||||
"install_busy": "已有安装正在进行。",
|
||||
"unknown": "发生未知错误。"
|
||||
|
||||
@@ -55,13 +55,20 @@ export function CopyMaintenance({ record, onError }: CopyMaintenanceProps) {
|
||||
return (
|
||||
<Sheet title={t('copies.sections.maintain')} aside={record.name}>
|
||||
<Row label={t('copies.maintenance.update')} hint={info?.sourceVersion
|
||||
? t(info.updateAvailable ? 'copies.maintenance.newVersion' : 'copies.maintenance.currentVersion', { version: info.sourceVersion })
|
||||
? t(info.updateAvailable
|
||||
? (record.hardlinkedFiles?.length ? 'copies.maintenance.updateDetaches' : 'copies.maintenance.newVersion')
|
||||
: 'copies.maintenance.currentVersion', { version: info.sourceVersion })
|
||||
: t('copies.maintenance.noSource')}>
|
||||
<button type="button" className={info?.updateAvailable ? 'button button-primary' : 'button'}
|
||||
disabled={working !== null || !info?.updateAvailable} onClick={() => run('update')}>
|
||||
{t('copies.maintenance.updateAction')}
|
||||
</button>
|
||||
</Row>
|
||||
<Row label={t('copies.maintenance.spaceSaving')} hint={info?.spaceSavingAvailable
|
||||
? t('copies.maintenance.spaceSavingHint') : t('copies.maintenance.spaceSavingUnavailable')}>
|
||||
<button type="button" className="button" disabled={working !== null || !info?.spaceSavingAvailable}
|
||||
onClick={() => run('compact')}>{t('copies.maintenance.compactAction')}</button>
|
||||
</Row>
|
||||
<Row label={t('copies.maintenance.check')} hint={record.lastCheckedAt
|
||||
? t('copies.maintenance.lastCheck', { date: new Date(record.lastCheckedAt).toLocaleString(i18n.language) })
|
||||
: t('copies.maintenance.checkHint')}>
|
||||
@@ -100,7 +107,7 @@ export function CopyMaintenance({ record, onError }: CopyMaintenanceProps) {
|
||||
<p>{t(`copies.maintenance.phase.${progress?.phase ?? 'checking'}`)}</p>
|
||||
<ProgressBar value={progress?.doneBytes ?? 0} max={progress?.totalBytes || null} />
|
||||
{progress?.totalBytes ? <p className="small">{formatBytes(progress.doneBytes)} / {formatBytes(progress.totalBytes)}</p> : null}
|
||||
{working === 'update' && progress?.phase !== 'applying' && (
|
||||
{(working === 'update' || working === 'compact') && progress?.phase !== 'applying' && (
|
||||
<button type="button" className="button" onClick={() => ipcInvoke('copies:cancelMaintenance').catch(onError)}>
|
||||
{t('wizard.cancel')}
|
||||
</button>
|
||||
|
||||
@@ -40,7 +40,7 @@ export function CopySummary({ record, supportedVersions, onShowFeatures, onError
|
||||
<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.method')}>{t(`copies.summary.methods.${record.method}`)}</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>
|
||||
<Row label={t('copies.summary.data')} hint={t('copies.summary.dataHint')}>{folder(record.dataPath)}</Row>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import type { ReactNode } from 'react';
|
||||
import type { Dispatch, ReactNode, SetStateAction } from 'react';
|
||||
import { useTranslation } from 'react-i18next';
|
||||
import type { FolderSize, GameFolderInspection, InstallMethod, TargetFolderInspection } from '@shared/schemas/install.ts';
|
||||
import { FolderField } from '../../components/FolderField.tsx';
|
||||
@@ -9,34 +9,42 @@ import { ipcInvoke } from '../../ipc.ts';
|
||||
/** Room the copy needs beyond the game itself; the main process checks the same margin. */
|
||||
const SPARE_BYTES = 1024 ** 3;
|
||||
|
||||
type Method = InstallMethod | 'hardlink';
|
||||
|
||||
export interface MethodChoice {
|
||||
readonly method: InstallMethod;
|
||||
readonly method: Method;
|
||||
readonly target: TargetFolderInspection | null;
|
||||
readonly steamConfirmed: boolean;
|
||||
}
|
||||
|
||||
interface MethodStepProps {
|
||||
readonly source: GameFolderInspection;
|
||||
/** Size of the installation; null while it is being measured. */
|
||||
readonly sourceSize: FolderSize | null;
|
||||
readonly choice: MethodChoice;
|
||||
readonly onChoice: (choice: MethodChoice) => void;
|
||||
readonly onChoice: Dispatch<SetStateAction<MethodChoice>>;
|
||||
readonly onError: (error: unknown) => void;
|
||||
}
|
||||
|
||||
/** Step 2: copy the game into a new folder, or install into the chosen folder itself. */
|
||||
export function MethodStep({ source, sourceSize, choice, onChoice, onError }: MethodStepProps) {
|
||||
const { t } = useTranslation();
|
||||
const choose = (method: InstallMethod): void => onChoice({ method, target: choice.target, steamConfirmed: false });
|
||||
const choose = (method: Method): void => onChoice({ method, target: choice.target, steamConfirmed: false });
|
||||
const inspectTarget = (path: string): void => {
|
||||
onChoice({ ...choice, target: null, steamConfirmed: false });
|
||||
onChoice((current) => ({ ...current, target: null, steamConfirmed: false }));
|
||||
ipcInvoke('install:inspectTargetFolder', { path, stockPath: source.path })
|
||||
.then((target) => onChoice({ method: 'copy', target, steamConfirmed: false }))
|
||||
.then((target) => onChoice((current) => ({ ...current, target, steamConfirmed: false })))
|
||||
.catch(onError);
|
||||
};
|
||||
const steamWarning = steamLibraryInvolved(source, choice)
|
||||
? <SteamWarning method={choice.method} confirmed={choice.steamConfirmed} onConfirmed={(steamConfirmed) => onChoice({ ...choice, steamConfirmed })} />
|
||||
: null;
|
||||
const targetPicker = (
|
||||
<>
|
||||
<FolderField path={choice.target?.path ?? null} dialogTitle={t('method.targetTitle')} onChosen={inspectTarget} onError={onError} />
|
||||
{choice.target && <TargetVerdict target={choice.target} sourceSize={sourceSize} method={choice.method} />}
|
||||
{steamWarning}
|
||||
</>
|
||||
);
|
||||
const savingAvailable = (sourceSize?.linkableBytes ?? 0) > 0;
|
||||
return (
|
||||
<>
|
||||
<Choice
|
||||
@@ -45,9 +53,20 @@ export function MethodStep({ source, sourceSize, choice, onChoice, onError }: Me
|
||||
body={sourceSize ? t('method.copyBody', { size: formatBytes(sourceSize.bytes) }) : t('method.copyBodyPending')}
|
||||
onSelect={() => choose('copy')}
|
||||
>
|
||||
<FolderField path={choice.target?.path ?? null} dialogTitle={t('method.targetTitle')} onChosen={inspectTarget} onError={onError} />
|
||||
{choice.target && <TargetVerdict target={choice.target} sourceSize={sourceSize} />}
|
||||
{steamWarning}
|
||||
{targetPicker}
|
||||
</Choice>
|
||||
<Choice
|
||||
selected={choice.method === 'hardlink'}
|
||||
disabled={!savingAvailable}
|
||||
title={t('method.spaceSaving')}
|
||||
body={sourceSize
|
||||
? savingAvailable
|
||||
? t('method.spaceSavingBody', { size: formatBytes(bytesToCopy(sourceSize, 'hardlink')) })
|
||||
: t('method.spaceSavingUnavailable')
|
||||
: t('method.spaceSavingPending')}
|
||||
onSelect={() => choose('hardlink')}
|
||||
>
|
||||
{targetPicker}
|
||||
</Choice>
|
||||
<Choice
|
||||
selected={choice.method === 'in-place'}
|
||||
@@ -63,17 +82,18 @@ export function MethodStep({ source, sourceSize, choice, onChoice, onError }: Me
|
||||
|
||||
interface ChoiceProps {
|
||||
readonly selected: boolean;
|
||||
readonly disabled?: boolean;
|
||||
readonly title: string;
|
||||
readonly body: string;
|
||||
readonly onSelect: () => void;
|
||||
/** Shown under the description while the choice is selected. */
|
||||
readonly children: ReactNode;
|
||||
}
|
||||
|
||||
function Choice({ selected, title, body, onSelect, children }: ChoiceProps) {
|
||||
function Choice({ selected, disabled, title, body, onSelect, children }: ChoiceProps) {
|
||||
return (
|
||||
<div className={selected ? 'choice choice-selected' : 'choice'} onClick={selected ? undefined : onSelect}>
|
||||
<input type="radio" name="method" checked={selected} onChange={onSelect} aria-label={title} />
|
||||
<div className={selected ? 'choice choice-selected' : 'choice'} aria-disabled={disabled}
|
||||
onClick={selected || disabled ? undefined : onSelect}>
|
||||
<input type="radio" name="method" checked={selected} disabled={disabled} onChange={onSelect} aria-label={title} />
|
||||
<span className="choice-title">{title}</span>
|
||||
<div className="choice-body">{body}</div>
|
||||
{selected && <div className="choice-detail">{children}</div>}
|
||||
@@ -81,16 +101,26 @@ function Choice({ selected, title, body, onSelect, children }: ChoiceProps) {
|
||||
);
|
||||
}
|
||||
|
||||
function TargetVerdict({ target, sourceSize }: { readonly target: TargetFolderInspection; readonly sourceSize: FolderSize | null }) {
|
||||
const { t } = useTranslation();
|
||||
if (target.problem) return <Notice tone="error">{t(`method.problem.${target.problem}`)}</Notice>;
|
||||
if (target.freeBytes !== null && sourceSize && target.freeBytes < sourceSize.bytes + SPARE_BYTES) {
|
||||
return <Notice tone="error">{t('method.noRoom', { needed: formatBytes(sourceSize.bytes + SPARE_BYTES), free: formatBytes(target.freeBytes) })}</Notice>;
|
||||
}
|
||||
return target.freeBytes === null ? null : <Notice tone="info">{t('method.room', { free: formatBytes(target.freeBytes) })}</Notice>;
|
||||
function bytesToCopy(size: FolderSize, method: Method): number {
|
||||
return size.bytes - (method === 'hardlink' ? (size.linkableBytes ?? 0) : 0);
|
||||
}
|
||||
|
||||
function SteamWarning({ method, confirmed, onConfirmed }: { readonly method: InstallMethod; readonly confirmed: boolean; readonly onConfirmed: (confirmed: boolean) => void }) {
|
||||
function TargetVerdict({ target, sourceSize, method }: {
|
||||
readonly target: TargetFolderInspection;
|
||||
readonly sourceSize: FolderSize | null;
|
||||
readonly method: Method;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
if (target.problem) return <Notice tone="error">{t(`method.problem.${target.problem}`)}</Notice>;
|
||||
if (method === 'hardlink' && !target.sameDriveAsStock) return <Notice tone="error">{t('method.sameVolumeRequired')}</Notice>;
|
||||
if (target.freeBytes === null || !sourceSize) return null;
|
||||
const needed = bytesToCopy(sourceSize, method) + SPARE_BYTES;
|
||||
return target.freeBytes < needed
|
||||
? <Notice tone="error">{t('method.noRoom', { needed: formatBytes(needed), free: formatBytes(target.freeBytes) })}</Notice>
|
||||
: <Notice tone="info">{t('method.room', { free: formatBytes(target.freeBytes) })}</Notice>;
|
||||
}
|
||||
|
||||
function SteamWarning({ method, confirmed, onConfirmed }: { readonly method: Method; readonly confirmed: boolean; readonly onConfirmed: (confirmed: boolean) => void }) {
|
||||
const { t } = useTranslation();
|
||||
return (
|
||||
<Notice tone="warning">
|
||||
@@ -113,5 +143,6 @@ export function methodUsable(source: GameFolderInspection, sourceSize: FolderSiz
|
||||
if (choice.method === 'in-place') return true;
|
||||
const target = choice.target;
|
||||
if (!target || target.problem || !sourceSize) return false;
|
||||
return target.freeBytes === null || target.freeBytes >= sourceSize.bytes + SPARE_BYTES;
|
||||
if (choice.method === 'hardlink' && (!target.sameDriveAsStock || !sourceSize.linkableBytes)) return false;
|
||||
return target.freeBytes === null || target.freeBytes >= bytesToCopy(sourceSize, choice.method) + SPARE_BYTES;
|
||||
}
|
||||
@@ -4,17 +4,22 @@ import { ProgressBar } from '../../components/ProgressBar.tsx';
|
||||
import { formatBytes } from '../../format.ts';
|
||||
|
||||
/**
|
||||
* Step 5: the installation running, phase by phase. Cancelling is in the bottom bar; only the
|
||||
* copy can be stopped, the other phases take seconds.
|
||||
* Step 5: the installation running, phase by phase. Resource verification and copying can be
|
||||
* cancelled from the bottom bar.
|
||||
*/
|
||||
export function ProgressStep({ progress }: { readonly progress: InstallProgress | null }) {
|
||||
export function ProgressStep({ progress, useHardLinks }: {
|
||||
readonly progress: InstallProgress | null;
|
||||
readonly useHardLinks: boolean;
|
||||
}) {
|
||||
const { t } = useTranslation();
|
||||
const phase = progress?.phase ?? 'checking';
|
||||
const current = INSTALL_PHASES.indexOf(phase);
|
||||
const copying = phase === 'copying' && progress !== null;
|
||||
const phases: readonly InstallProgress['phase'][] = useHardLinks ? INSTALL_PHASES : INSTALL_PHASES.filter((name) => name !== 'verifying');
|
||||
const current = phases.indexOf(phase);
|
||||
const tracking = (phase === 'copying' || phase === 'verifying') && progress !== null;
|
||||
const caption = phase === 'verifying' ? 'progress.verified' : useHardLinks ? 'progress.prepared' : 'progress.copied';
|
||||
return (
|
||||
<>
|
||||
{INSTALL_PHASES.map((name, position) => {
|
||||
{phases.map((name, position) => {
|
||||
const state = position < current ? 'done' : position === current ? 'current' : 'pending';
|
||||
return (
|
||||
<div key={name} className={`phase phase-${state}`}>
|
||||
@@ -23,10 +28,10 @@ export function ProgressStep({ progress }: { readonly progress: InstallProgress
|
||||
</div>
|
||||
);
|
||||
})}
|
||||
<ProgressBar value={copying ? progress.doneBytes : 0} max={copying ? progress.totalBytes : null} large />
|
||||
{copying && (
|
||||
<ProgressBar value={tracking ? progress.doneBytes : 0} max={tracking ? progress.totalBytes : null} large />
|
||||
{tracking && (
|
||||
<div className="progress-caption">
|
||||
{t('progress.copied', {
|
||||
{t(caption, {
|
||||
done: formatBytes(progress.doneBytes),
|
||||
total: formatBytes(progress.totalBytes),
|
||||
doneFiles: progress.doneFiles.toLocaleString(),
|
||||
|
||||
@@ -27,7 +27,7 @@ export function WizardMain({ wizard, supportedVersions }: { readonly wizard: Ins
|
||||
)}
|
||||
{step === 'data' && <DataStep dataPath={wizard.dataPath} onDataPath={wizard.setDataPath} onError={wizard.report} />}
|
||||
{step === 'check' && <CheckStep check={wizard.check} missingAccepted={wizard.missingAccepted} onMissingAccepted={wizard.setMissingAccepted} />}
|
||||
{step === 'installing' && <ProgressStep progress={wizard.progress} />}
|
||||
{step === 'installing' && <ProgressStep progress={wizard.progress} useHardLinks={wizard.choice.method === 'hardlink'} />}
|
||||
{wizard.message && <p className="error-text" role="alert">{wizard.message}</p>}
|
||||
</Sheet>
|
||||
);
|
||||
|
||||
@@ -40,7 +40,7 @@ export function useInstallWizard({ onInstalled }: WizardOptions) {
|
||||
setSourceSize(null);
|
||||
if (!sourceUsable(source)) return;
|
||||
let current = true;
|
||||
ipcInvoke('install:measureFolder', { path: source.path })
|
||||
ipcInvoke('install:measureFolder', { path: source.path, version: source.version })
|
||||
.then((size) => current && setSourceSize(size))
|
||||
.catch((error: unknown) => current && report(error));
|
||||
return () => {
|
||||
@@ -92,9 +92,9 @@ export function useInstallWizard({ onInstalled }: WizardOptions) {
|
||||
const install = (): void => {
|
||||
if (!sourceUsable(source) || !draftId) return;
|
||||
const choices = { id: draftId, name, dataPath, steamLibraryConfirmed: choice.steamConfirmed, missingFeaturesAccepted: missingAccepted };
|
||||
const request: InstallRequest = choice.method === 'copy'
|
||||
? { method: 'copy', sourcePath: source.path, copyPath: choice.target!.path, ...choices }
|
||||
: { method: 'in-place', gamePath: source.path, ...choices };
|
||||
const request: InstallRequest = choice.method === 'in-place'
|
||||
? { method: 'in-place', gamePath: source.path, ...choices }
|
||||
: { method: 'copy', useHardLinks: choice.method === 'hardlink', sourcePath: source.path, copyPath: choice.target!.path, ...choices };
|
||||
clear();
|
||||
setProgress(null);
|
||||
setCancelling(false);
|
||||
|
||||
@@ -10,12 +10,12 @@ export function wizardBar(wizard: InstallWizard, t: TFunction): BarModel {
|
||||
|
||||
if (step === 'installing') {
|
||||
const phase = progress?.phase ?? 'checking';
|
||||
const copying = phase === 'copying' && progress !== null;
|
||||
const tracking = (phase === 'copying' || phase === 'verifying') && progress !== null;
|
||||
return {
|
||||
tone: 'busy',
|
||||
title: t(`progress.phase.${phase}`),
|
||||
detail: copying ? t('progress.cancelHint') : stepOf,
|
||||
progress: copying
|
||||
detail: tracking ? t('progress.cancelHint') : stepOf,
|
||||
progress: tracking
|
||||
? {
|
||||
value: progress.doneBytes,
|
||||
max: progress.totalBytes,
|
||||
@@ -24,7 +24,7 @@ export function wizardBar(wizard: InstallWizard, t: TFunction): BarModel {
|
||||
}
|
||||
: { value: 0, max: null },
|
||||
primary: { label: t('wizard.installing'), disabled: true },
|
||||
...(copying ? { secondary: { label: cancelling ? t('progress.cancelling') : t('progress.cancel'), disabled: cancelling, onClick: wizard.cancel } } : {}),
|
||||
...(tracking ? { secondary: { label: cancelling ? t('progress.cancelling') : t('progress.cancel'), disabled: cancelling, onClick: wizard.cancel } } : {}),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -353,6 +353,11 @@
|
||||
border-color: var(--line-strong);
|
||||
}
|
||||
|
||||
.choice[aria-disabled='true'] {
|
||||
cursor: default;
|
||||
opacity: 0.7;
|
||||
}
|
||||
|
||||
.choice-selected {
|
||||
border-color: var(--red);
|
||||
background: rgba(229, 57, 53, 0.08);
|
||||
|
||||
Reference in new issue
Block a user