This commit is contained in:
patchzyy authored and GitHub committed 2026-09-05 09:55:09 +02:00
1 parent 602348f905
commit e34f055b3a
1 file changed
+12 -6
@@ -22,6 +22,9 @@ internal sealed class InstallerEngine
var existing = new Installation(installDirectory); var existing = new Installation(installDirectory);
PortableInstallHealing.HealMovedInstall(existing, _reporter); PortableInstallHealing.HealMovedInstall(existing, _reporter);
// Capture this before publishing anything. An existing installation may be repaired or
// updated by this invocation, but those operations must not recreate the user's shortcuts.
var firstInstall = !existing.IsPresent;
var previousState = existing.ReadInstallState(); var previousState = existing.ReadInstallState();
using var scratch = Directory.Exists(installDirectory) using var scratch = Directory.Exists(installDirectory)
? InstallScratchSpace.CreateInsideInstall(installDirectory, _reporter) ? InstallScratchSpace.CreateInsideInstall(installDirectory, _reporter)
@@ -139,7 +142,7 @@ internal sealed class InstallerEngine
updatedState.RetroRewindInstalled, candidateRuntimeAssetsFingerprint, updatedState.RetroRewindInstalled, candidateRuntimeAssetsFingerprint,
remainingCancellation); remainingCancellation);
Publish(staging, installDirectory, canonicalRetroRoot, updatedState, Publish(staging, installDirectory, canonicalRetroRoot, updatedState,
releaseEntries, remainingCancellation); releaseEntries, remainingCancellation, createShortcuts: firstInstall);
return; return;
} }
@@ -161,7 +164,8 @@ internal sealed class InstallerEngine
await PublishToolkitAndReconcileProductsAsync(existing, staging, workspace, manifest, await PublishToolkitAndReconcileProductsAsync(existing, staging, workspace, manifest,
previousState, options, canonicalRetroRoot, retroCompileInputs, previousState, options, canonicalRetroRoot, retroCompileInputs,
publishGameAssets: reusableGameAssets is null, cancellationToken); publishGameAssets: reusableGameAssets is null, createShortcuts: firstInstall,
cancellationToken: cancellationToken);
} }
@@ -186,7 +190,7 @@ internal sealed class InstallerEngine
string stagedWorkspace, PayloadManifest manifest, InstallState? previousState, string stagedWorkspace, PayloadManifest manifest, InstallState? previousState,
InstallOptions options, string? canonicalRetroRoot, InstallOptions options, string? canonicalRetroRoot,
RetroRewindCompileInputs? retroCompileInputs, RetroRewindCompileInputs? retroCompileInputs,
bool publishGameAssets, CancellationToken cancellationToken) bool publishGameAssets, bool createShortcuts, CancellationToken cancellationToken)
{ {
var installDirectory = existing.Root; var installDirectory = existing.Root;
@@ -214,7 +218,8 @@ internal sealed class InstallerEngine
if (publishGameAssets) AddComponent(entries, staging, installDirectory, "GameAssets"); if (publishGameAssets) AddComponent(entries, staging, installDirectory, "GameAssets");
Publish(staging, installDirectory, canonicalRetroRoot, state, Publish(staging, installDirectory, canonicalRetroRoot, state,
entries, cancellationToken, progressPercent: 8, completionPercent: 10); entries, cancellationToken, progressPercent: 8, completionPercent: 10,
createShortcuts: createShortcuts);
_reporter.Progress(InstallStages.BuildBase, _reporter.Progress(InstallStages.BuildBase,
"Producing the installed products with the published toolkit...", 11); "Producing the installed products with the published toolkit...", 11);
@@ -277,7 +282,7 @@ internal sealed class InstallerEngine
private void Publish(string staging, string installDirectory, private void Publish(string staging, string installDirectory,
string? canonicalRetroRoot, InstallState state, string? canonicalRetroRoot, InstallState state,
List<InstallTransactionEntry> entries, CancellationToken cancellationToken, List<InstallTransactionEntry> entries, CancellationToken cancellationToken,
int progressPercent = 95, int completionPercent = 99) int progressPercent = 95, int completionPercent = 99, bool createShortcuts = false)
{ {
entries.Add(InstallTransactionEntry.Directory(Path.Combine(staging, "licenses"), entries.Add(InstallTransactionEntry.Directory(Path.Combine(staging, "licenses"),
Path.Combine(installDirectory, "licenses"))); Path.Combine(installDirectory, "licenses")));
@@ -322,7 +327,8 @@ internal sealed class InstallerEngine
{ {
ShellIntegration.RegisterUninstaller(installDirectory, state.RetroRewindInstalled); ShellIntegration.RegisterUninstaller(installDirectory, state.RetroRewindInstalled);
} }
ShellIntegration.CreateShortcuts(installDirectory); if (createShortcuts)
ShellIntegration.CreateShortcuts(installDirectory);
} }
catch (Exception ex) catch (Exception ex)
{ {