-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
InMemoryDirectoryInfo constructor not recognizing root #93107
Comments
Tagging subscribers to this area: @dotnet/area-system-io Issue DetailsDescriptionHi, so unless i'm totally overseeing something here, the behavior of the The documentation however states this:
Reproduction StepsSee the following code: var files = new List<string>{"Test.txt", "New/../Test.txt", "new/test.txt"};
var fs = new InMemoryDirectoryInfo("x:/", files);
var i = fs.EnumerateFileSystemInfos().ToList(); Expected behaviorexpected result of
Actual behaviorThe actual result is empty. Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
Tagging subscribers to this area: @dotnet/area-extensions-filesystem Issue DetailsDescriptionHi, so unless i'm totally overseeing something here, the behavior of the The documentation however states this:
Reproduction StepsSee the following code: var files = new List<string>{"Test.txt", "New/../Test.txt", "new/test.txt"};
var fs = new InMemoryDirectoryInfo("x:/", files);
var i = fs.EnumerateFileSystemInfos().ToList(); Expected behaviorexpected result of
Actual behaviorThe actual result is empty. Regression?No response Known WorkaroundsNo response ConfigurationNo response Other informationNo response
|
I think the problem is that we use GetFullPath here: I think this also looks like a duplicate of #50648 Looking at the tests, this somewhat looks like scenario similar to yours: runtime/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/FunctionalTests.cs Line 848 in 52806bc
Would you be interested in creating a PR with couple of tests with a fix? |
I'm closing this as dup of #50648 |
Description
Hi,
so unless i'm totally overseeing something here, the behavior of the
InMemoryDirectoryInfo
constructor irritates me a lot.It seems that the parameter
rootDir
is not acutally used to resolve relative path.The documentation however states this:
Reproduction Steps
See the following code:
Expected behavior
expected result of
i
is a list containing 3 items of the following file names:Actual behavior
The actual result is empty.
In the debugger you can also see that the relative paths have been resolved to the applications current directory (so something like c:/dev/app/bin/debug/test.txt)
Regression?
No response
Known Workarounds
No response
Configuration
No response
Other information
No response
The text was updated successfully, but these errors were encountered: