-
Notifications
You must be signed in to change notification settings - Fork 43
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
3 bugs - Directory.GetFiles - Directory.GetDirectories & Directory.Move #15
Comments
I can't reproduce 1 and 2, these cases work fine for me. As for 3, this is probably because you have something open in the source directory. You would get the same error with System.IO.Directory.Move. |
Thanks for the super fast reply. The System.IO.Directory.Move works fine for me i.e. never encounters this exception. Your implementation however, fails often (~40%). There is definitely a bug here. |
These 2 examples fail (i.e. no files or directories found) for me... Create: C:\Test\a folder 1\b folder 2\somefile.txt var files = Directory.GetFiles("C:\Test","some*.txt",System.IO.SearchOption.AllDirectories); var dirs = Directory.GetDirectories("C:\Test","b folder*",System.IO.SearchOption.AllDirectories); |
OK, I was just testing with "." as the filter... now I see the problem. (I'm not the maintainer of this project, btw) |
Yes, thanks for the follow up @thomaslevesque. Your day must start earlier than mine :) I gather you've reproduced it? Thanks for the report @YetAnotherPhil, I'll look into it. |
Thanks guys, much appreciated |
Here's a modified version of your EnumerateFileSystemIteratorRecursive (not thoroughly tested by any means!)...
|
Thanks. I need to work through some Visual Studio issues that I've encountered with this project; but I hope to thow this on my backlog soon. |
The Directory.Move bug... The wrong (different) exception was thrown when a file\folder is locked. Below is a modified version of your GetExceptionFromWin32Error to correct the issue:
|
This change doesn't make sense, you're just hiding some information. If the system returned "access denied", it's better to throw an |
Try this... Create c:\test\somefile.txt Open Explorer.exe in c:\test to lock the folder Now run try try You should see System.IO.Directory.Move raises a System.IO.IOException. |
This is some hours code to expand the unit tests. I'll verify the results and evaluate how to change the code to fix this and not break something else. Thanks |
I've committed a change that should deal with the first issue. Similar to what you posted @YetAnotherPhil, but a little more efficient. |
I just added some unit tests to verify case two is also fixed. |
Commit 8b6011e fixes the |
I tried your Pri.LongPath package yesterday & found the following issues:
Directory.GetFiles(FilePath,FileNamePattern,System.IO.SearchOption.AllDirectories)
Directory.GetDirectories(FilePath,FolderNamePattern,System.IO.SearchOption.AllDirectories)
Directory.Move(oldFolder, newFolder)
The text was updated successfully, but these errors were encountered: