Skip to content

Conversation

@mostynb
Copy link
Contributor

@mostynb mostynb commented Jul 2, 2025

This is an attempt to fix #1304.

@vbreuss
Copy link
Member

vbreuss commented Jul 3, 2025

@mostynb : Thanks for the PR. Could you please check the failing actions?

What happens on the real file system when you use Directory.GetFiles when the directory is prefixed with \\?\? Are the returned strings also prefixed with \\?\?

@mostynb mostynb changed the title Make MockFileSystems Directory.Create work with \\?\C:\foo style paths fix: MockFileSystems Directory.Create fails with \\?\C:\foo style paths Jul 4, 2025
@mostynb mostynb force-pushed the path_verifier_extended_length_paths branch from c8ba403 to b9d59a2 Compare July 4, 2025 12:12
@mostynb
Copy link
Contributor Author

mostynb commented Jul 4, 2025

Pushed an update which added braces to the if block, and updated the PR title.

What happens on the real file system when you use Directory.GetFiles when the directory is prefixed with \?? Are the returned strings also prefixed with \??

If I give System.IO.Directory.GetFiles() a \?\ style path on windows, it returns \?\ style paths.

@vbreuss
Copy link
Member

vbreuss commented Jul 6, 2025

@mostynb

If I give System.IO.Directory.GetFiles() a \\?\ style path on windows, it returns \\?\ style paths.

But this does not work on the MockFileSystem, even after this pull request, right?

@mostynb mostynb changed the title fix: MockFileSystems Directory.Create fails with \\?\C:\foo style paths fix: MockFileSystem's File.WriteAllText, File.ReadAllText, Directory.GetFiles, Directory.Create fail with \\?\C:\foo style paths Jul 6, 2025
@mostynb
Copy link
Contributor Author

mostynb commented Jul 6, 2025

@mostynb

If I give System.IO.Directory.GetFiles() a \\?\ style path on windows, it returns \\?\ style paths.

But this does not work on the MockFileSystem, even after this pull request, right?

It did not, so I pushed some changes to make it work, assuming that you always use \\?\ style paths.

However, extended length paths aren't normalised internally in MockFileSystem. eg if I create \\?\C:\foo\bar.txt then I can read \\?\C:\foo\bar.txt, but C:\foo\bar.txt does not appear to exist.

…ry.GetFiles support extended length paths too
@mostynb mostynb force-pushed the path_verifier_extended_length_paths branch from eeb83c3 to 0918171 Compare July 6, 2025 18:32
@vbreuss vbreuss merged commit 2ad3fd6 into TestableIO:main Jul 8, 2025
9 checks passed
@vbreuss
Copy link
Member

vbreuss commented Jul 8, 2025

Thanks @mostynb, will publish v22.0.15 shortly!

@github-actions
Copy link

github-actions bot commented Jul 8, 2025

This is addressed in release v22.0.15.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: released Issues that are released

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MockFileSystem's IDirectoryInfo.Create implementation fails with \\?\C:\Foo style paths

2 participants