peteraritchie / LongPath

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

Fix for issue #45 #51

Closed monkeyhell closed 7 years ago

monkeyhell commented 7 years ago

I first added 2 unit tests that demonstrate issues when dealing with UNC paths near the MAX_PATH limit, one in Directory.CreateDirectory and one in Directory.EnumerateDirectories.

Empirically, I found that the point at which Windows starts getting upset is MAX_PATH minus the length of the \\hostname\ prefix of the UNC path. I was therefore able to fix both issues by modifying the Path.CheckAddLongPathPrefix method such that it adds the long path prefix if the path exceeds this limit, rather than MAX_PATH.