alphaleonis / AlphaFS

AlphaFS is a .NET library providing more complete Win32 file system functionality to the .NET platform than the standard System.IO classes.
http://alphafs.alphaleonis.com/
MIT License
562 stars 99 forks source link

Fixed PathTooLongException for boundary case of directory name length in Path.NormalizePath #437

Closed okrushelnitsky closed 6 years ago

okrushelnitsky commented 6 years ago

There is a problem with paths that contain components with maximum length (255 chars in Windows). This paths are valid but Path.NormalizePath method throws exception PathTooLongException. Path.NormalizePath has checks for length of path components but this checks contains miscalculation for one char.

Yomodo commented 6 years ago

Thanks!

okrushelnitsky commented 6 years ago

No problem.

Yomodo commented 6 years ago

This fix causes a unit test to fail: DirectoryInfo_CatchPathTooLongException_FolderNameGreaterThan255Characters_LocalAndNetwork_Success()

How does your path look like?

okrushelnitsky commented 6 years ago

Sorry, I wrongly interpreted condition after normalization 'while' cycle in NormalizePath. Condition in 'while' cycle I fixed rightly.

The path looks like: E:\temp\<255 chars>\testfile.txt