You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Set-Location to any filesystem directory that isn't [System.Environment]::CurrentDirectory. In practice this means "not $HOME".
Call Find-Item foo where foo is a relative path that exists in the test location but ideally not in $HOME either.
A more formal example:
# we need a temporary dir, unfortunately APIs only let us create temporary files.# Fortunately I have a workaround.New-TemporaryFile|% { rm $_; mkdir $_ } |Set-Location# now we need a child with a unique name too. Using a Guid since it **should** be unique.$path= [Guid]::NewGuid().ToString()
mkdir $path# Put a file in the new directory for good measure
echo ''> (Join-Path${path}'foo.txt')
# Now find.Find-Item-Path $path
Context
Your Environment
Module version used: 0.3.6
Operating System and PowerShell version: Microsoft Windows 10.0.26100 (24H2) x64, PowerShell 7.4.x and 7.5.0.
The text was updated successfully, but these errors were encountered:
When specifying a relative path to
-Path
, it is resolved to the wrong current directory, frequently resulting in errors like the following:Expected Behavior
Find-Item -Path "foo"
should crawl "$PWD\foo".Current Behavior
Find-Item -Path "foo"
crawls "$([System.Environment]::CurrentDirectory)\foo", throwing an error if it is not found.Possible Solution
Resolve the path using PowerShell APIs. See #18 .
Steps to Reproduce (for bugs)
[System.Environment]::CurrentDirectory
. In practice this means "not $HOME".Find-Item foo
wherefoo
is a relative path that exists in the test location but ideally not in $HOME either.A more formal example:
Context
Your Environment
The text was updated successfully, but these errors were encountered: