Skip to content

Honor explicit per-package install location on WinGet update#5173

Merged
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/5164-custom-location-ignored-on-update
Jul 22, 2026
Merged

Honor explicit per-package install location on WinGet update#5173
Gabriel Dufresne (GabrielDuf) merged 3 commits into
mainfrom
fix/5164-custom-location-ignored-on-update

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request improves how custom install locations are handled for package installations and updates, ensuring that only explicitly set per-package locations are always honored, while manager-wide defaults remain opt-in for updates. The main changes introduce a new property to track whether a custom location was set explicitly for a package, and update the logic and tests accordingly.

Custom Install Location Handling:

  • Added a CustomInstallLocationIsExplicit property to the InstallOptions class to indicate if a location was set explicitly for a package rather than inherited from a manager-wide default. This property is transient and not serialized.
  • Updated the InstallOptions.Copy() method to ensure the new CustomInstallLocationIsExplicit property is copied correctly.

Install Options Factory Logic:

  • Modified InstallOptionsFactory.LoadApplicable to set CustomInstallLocationIsExplicit based on whether the location was explicitly set for the package (OverridesNextLevelOpts).

WinGet Package Operation Logic:

  • Updated the logic in WinGetPkgOperationHelper.cs so that on updates, only explicit per-package install locations are always honored; inherited manager-wide defaults require the opt-in setting as before. This prevents unintended relocation of existing installs.

Testing:

  • Added a new test to InstallOptionsFactoryTests to verify that CustomInstallLocationIsExplicit is correctly set for explicit per-package overrides and not for inherited manager defaults.

Resolves conflict in WinGetPkgOperationHelper: main extracted the update
install-location logic into GetEffectiveUpdateLocation(). Ported the #5164
explicit-per-package rule (honor CustomInstallLocationIsExplicit, keep the
manager-wide default gated behind WinGetForceLocationOnUpdate for #4210)
into that helper.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Tracks whether install locations are package-specific so WinGet updates can distinguish them from manager defaults.

Changes:

  • Adds and propagates an explicit-location marker.
  • Updates WinGet location resolution.
  • Adds factory-level tests.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
InstallOptionsFactoryTests.cs Tests location provenance.
InstallOptions.cs Adds and copies the transient marker.
InstallOptionsFactory.cs Determines location provenance.
WinGetPkgOperationHelper.cs Applies explicit locations during updates.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/UniGetUI.PackageEngine.Tests/InstallOptionsFactoryTests.cs
@GabrielDuf Gabriel Dufresne (GabrielDuf) linked an issue Jul 22, 2026 that may be closed by this pull request
3 tasks
@GabrielDuf
Gabriel Dufresne (GabrielDuf) merged commit 905bcd1 into main Jul 22, 2026
8 of 9 checks passed
@GabrielDuf
Gabriel Dufresne (GabrielDuf) deleted the fix/5164-custom-location-ignored-on-update branch July 22, 2026 18:03
@GabrielDuf Gabriel Dufresne (GabrielDuf) linked an issue Jul 22, 2026 that may be closed by this pull request
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] Plenty of tolerated custom paths for updates

3 participants