Repository navigation
Add test to verify filesystem provider isn't used when accessing root path in psdrive - #7173
Conversation
Now I try |
|
Ilya (@iSazonov) There's a fundamental problem with PSDrives on non-Windows and will probably become a bigger issues as more SHiPS based providers are written that are cross platform. We should discuss that here #6773 |
| It "Should not use filesystem root folder if not in filesystem provider" -Skip:(!$IsWindows) { | ||
| # find filesystem root folder that doesn't exist in HKCU: | ||
| $foundFolder = $false | ||
| foreach ($folder in (Get-ChildItem "${env:SystemDrive}\" -Directory)) { |
There was a problem hiding this comment.
The parens around Get-ChildItem are unnecessary.
| # find filesystem root folder that doesn't exist in HKCU: | ||
| $foundFolder = $false | ||
| foreach ($folder in (Get-ChildItem "${env:SystemDrive}\" -Directory)) { | ||
| if (!(Test-Path "HKCU:\$($folder.Name)")) { |
There was a problem hiding this comment.
I think the convention is to use -not instead of ! simply because it's more visible.
| } | ||
| } | ||
| $foundFolder | Should -BeTrue | ||
| Set-Location HKCU:\ |
There was a problem hiding this comment.
Use Push-Location HKCU:\ in try and Pop-Location in finally to reset the current working directory.
There was a problem hiding this comment.
This is for Set-Location tests, though. There's a BeforeAll and AfterAll that sets the location back to where it was.
There was a problem hiding this comment.
Ok. closed.
|
Aditya Patwardhan (@adityapatwardhan) this needs your review approval. It looks ready for merge. |
|
Aditya Patwardhan (@adityapatwardhan) can you re-review? |
… path in psdrive (PowerShell#7173) * add test to verify filesystem isn't used when not in filesystem drive
PR Summary
This was an issue introduced by 7459b54.
When in a PSDrive, and you set-location to a root qualified path, it should be based on the current psdrive and not the filesystem. Exception is on non-Windows, all paths start with
/so it's always treated as filesystem.PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:to the beginning of the title and remove the prefix when the PR is ready.[feature]if the change is significant or affects feature tests