peteraritchie / LongPath

drop-in library to support long paths in .NET
GNU Lesser General Public License v3.0
112 stars 43 forks source link

DirectoryInfo.LastWriteTime throws FileNotFoundException on the root folder of a drive #18

Closed thomaslevesque closed 9 years ago

thomaslevesque commented 9 years ago
System.IO.FileNotFoundException: File D:\ not found
File name: 'D:\'
   at Pri.LongPath.Common.ThrowIOError(Int32 errorCode, String maybeFullPath)
   at Pri.LongPath.FileSystemInfo.get_LastWriteTimeUtc()
   at Pri.LongPath.FileSystemInfo.get_LastWriteTime()
   at UserQuery.Main() in c:\Users\Tom\AppData\Local\Temp\LINQPad\_himmmwze\query_ijinft.cs:line 56

The same error occurs for all the creation/modification/las access properties.

In System.IO.DirectoryInfo, it works as expected.

peteraritchie commented 9 years ago

I've reproduced and I'll have a look at it, probably today. thanks

peteraritchie commented 9 years ago

Added test to detect the problem and added fix. FindFirstFile does not work with root dir and no wildcard--fix was to add a wildcard