System.IO.Abstractions icon indicating copy to clipboard operation
System.IO.Abstractions copied to clipboard

MockPath.GetFullPath does not match windows behavior.

Open AnakinRaW opened this issue 2 years ago • 7 comments

Describe the bug In a special case of a rooted, but not absolute path, MockPath.GetFullPath produces results which differ from what i get using System.IO.Path.GetFullPath

To Reproduce

var fs = new MockFileSystem();
Console.WriteLine("Mocking: " + fs.Path.GetFullPath("d:test.txt"));
Console.WriteLine("OS: " + Path.GetFullPath("d:test.txt"));
Output (Linux):
Mocking: /d:test.txt
OS: /home/USER/d:test.txt

Output (Windows):
Mocking: d:test.txt
OS: D:\test.txt

Expected behavior I expect the values to be equal.

AnakinRaW avatar Oct 08 '23 11:10 AnakinRaW

@AnakinRaW : Are you sure, your test is correct? The provided input "d:test.txt" is no valid (rooted) path. Maybe it should be @"d:\test.txt" instead?

vbreuss avatar Oct 09 '23 08:10 vbreuss

i'm sure my test is correct. even microsoft documented this case in their code comments: https://github.com/dotnet/runtime/blob/main/src/libraries/System.Private.CoreLib/src/System/IO/Path.cs#L297

AnakinRaW avatar Oct 09 '23 15:10 AnakinRaW

Thanks for the clarification, @AnakinRaW ! I was not aware of this format, but after looking around, it is also documented in the File path formats on Windows systems :-)

vbreuss avatar Oct 10 '23 07:10 vbreuss

Wow, what a fancy feature.

fgreinacher avatar Oct 10 '23 11:10 fgreinacher