Skip to content

Remove the stale bundled-Chocolatey install variable - #5306

Open
Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
fix/stale-chocolatey-install-variable
Open

Remove the stale bundled-Chocolatey install variable#5306
Gabriel Dufresne (GabrielDuf) wants to merge 2 commits into
mainfrom
fix/stale-chocolatey-install-variable

Conversation

@GabrielDuf

Copy link
Copy Markdown
Contributor

This pull request introduces logic to detect and clean up legacy bundled Chocolatey installations, improving the robustness of environment variable handling and initialization. The changes add detection for outdated user environment variables pointing to unsupported Chocolatey paths, ensure these are removed during initialization, and provide comprehensive tests for the new functionality.

Legacy Chocolatey path handling and cleanup:

  • Added a list of legacy bundled Chocolatey installation paths and logic to detect if a given path matches any of them, including normalization and environment variable expansion (Chocolatey.cs).
  • Implemented a method to remove stale ChocolateyInstall user environment variables if they point to a legacy bundled location, and hooked this into the pre-initialization steps for the Chocolatey manager (Chocolatey.cs).
  • Introduced a virtual _performPreInitializationSteps method in the base manager class and ensured it is called during initialization (PackageManager.cs).

Testing improvements:

  • Added unit tests to verify correct detection of legacy bundled Chocolatey paths, proper handling of system/unrelated paths, and correct expansion of environment variable syntax in paths (ChocolateyManagerTests.cs).

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

Adds initialization-time cleanup for legacy bundled Chocolatey environment variables.

Changes:

  • Detects normalized legacy Chocolatey paths.
  • Adds a pre-initialization manager hook.
  • Adds path-detection unit tests.

Reviewed changes

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

File Description
ChocolateyManagerTests.cs Tests legacy-path detection.
PackageManager.cs Adds the pre-initialization hook.
Chocolatey.cs Detects legacy paths and cleans environment variables.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs Outdated
Comment thread src/UniGetUI.PackageEngine.Managers.Chocolatey/Chocolatey.cs
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.

3 participants