Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update unix local user paths #1464

Merged
merged 1 commit into from
Oct 27, 2023
Merged

Conversation

alerickson
Copy link
Member

@alerickson alerickson commented Oct 27, 2023

PR Summary

Starting in .NET 8, the behavior of Environment.GetFolderPath on Unix operating systems will change.

.NET 8 and above include breaking changes that impact paths which PSResourceGet relies on for script and module installation and discovery. When using CurrentUser scope, PSResourceGet uses the .NET environment variable Environment.SpecialFolder.LocalApplicationData to retrieve the appropriate path.
See GetFolderPath behavior on Unix for an exact mapping on both Linux and macOS systems.

What this means is that PSResourceGet, which is expected to use $HOME/.local/share/powershell/Modules, actually uses $HOME/Library/Application Support/powershell/Modules
if .NET 8+ is in use.

This can cause unexpected issues for a couple of reasons any modules or scripts installed with .NET 7 and below will not be discoverable with .NET 8 and above.

This PR resolves the issue by retrieving the unix local user path in a similar manner as PowerShell, by hardcoding the path.

PR Context

Resolves #1454

PR Checklist

@alerickson alerickson merged commit ece1872 into PowerShell:master Oct 27, 2023
3 checks passed
@alerickson alerickson deleted the unixPaths branch October 27, 2023 18:33
anamnavi pushed a commit that referenced this pull request Nov 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

macOS: -Scope CurrentUser targets a directory not listed in $env:PSModulePath
2 participants