| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
| foreach (string directory in tokenizedPath) | ||
| { | ||
| string tempDir = directory.TrimStart(); | ||
| if (tempDir.EqualsOrdinalIgnoreCase("~")) |
There was a problem hiding this comment.
This should only check the very first directory, right? I don't know if tilda can be in the middle...
Sorry, something went wrong.
There was a problem hiding this comment.
I'd expect that we expand tilde for all elements. There are other applications which add their paths.
Sorry, something went wrong.
There was a problem hiding this comment.
My intent here is to only handle the beginning case which is the most common case. ~ in the middle doesn't make sense.
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
|
If we do this for PATH, shall we do the same for PSModulePath then? |
Sorry, something went wrong.
|
There are potentially other PATH values where we might want to apply this as well. I don't recall the exact names off the top of my head, but don't Mac and Linux have PATH-type environment variables that dictate where to look for native library dependencies to load? |
Sorry, something went wrong.
| } | ||
|
|
||
| BeforeAll { | ||
| $oldPath = $env:PATH |
There was a problem hiding this comment.
I guess it is tabs here and below. Please fix indentations.
Sorry, something went wrong.
There was a problem hiding this comment.
I noticed the file was mixed formatting, I'll reformat the entire file.
Sorry, something went wrong.
|
|
||
| Copy-Item -Path $pwsh -Destination "~/$pwsh2" | ||
| $testPath = Join-Path -Path "~" -ChildPath (New-Guid) | ||
| New-Item -Path $testPath -ItemType Directory |
There was a problem hiding this comment.
| New-Item -Path $testPath -ItemType Directory | |
| New-Item -Path $testPath -ItemType Directory > $null |
Sorry, something went wrong.
| foreach (string directory in tokenizedPath) | ||
| { | ||
| string tempDir = directory.TrimStart(); | ||
| if (tempDir.EqualsOrdinalIgnoreCase("~")) |
There was a problem hiding this comment.
I'd expect that we expand tilde for all elements. There are other applications which add their paths.
Sorry, something went wrong.
|
From https://github.com/dotnet/cli/issues/9321 I see that only $HOME works for zsh and MacOs. |
Sorry, something went wrong.
|
Rain Sallow (/u/ta11ow) (@vexx32), you're thinking of LD_LIBRARY_PATH. Similar for PSModulePath, I'm not sure if we want to promote usage of this. This change was specifically to address the dotnet global tool issue. |
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT) yeah I understand that. My concern is simply that we will now have two separate ways we handle the one "kind" of environment variable. It's certainly not desirable to promote this oddity too much, I'll agree, but I wonder whether it's better / simpler to be consistent here and have a single way of handling at least initial path resolution for paths in these variables? |
Sorry, something went wrong.
|
I think we need to document the feature. |
Sorry, something went wrong.
|
PoshChan-Bot (@PoshChan) please retry windows |
Sorry, something went wrong.
|
Steve Lee (@SteveL-MSFT), successfully started retry of PowerShell-CI-Windows |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM but maybe open an issue to support Tilda in other PATH-like variables.
Sorry, something went wrong.
|
🎉v7.0.0-rc.2 has been released which incorporates this pull request.:tada: Handy links: |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
PR Summary
The ~ meaning user home path is a commonly used convention. Bash (and compatible shells) expands this automatically (along with other derivatives not covered in this PR). Dotnet global tools sets $env:PATH with a path to the tools starting with ~. In PowerShell, that is treated as a literal so the tools aren't found. Fix is in command discovery, when processing $env:PATH, handle the case where a sub-path starts with ~/ or just contains ~ and expand it to be the user home path.
PR Context
Fix #11531
PR Checklist