swiftlang / swift-corelibs-foundation

The Foundation Project, providing core utilities, internationalization, and OS independence
swift.org
Apache License 2.0
5.29k stars 1.13k forks source link

`FileMangager.enumerator(at:)` stops enumerating after hitting path with more than 260 characters on Windows #5099

Open ahoppen opened 1 month ago

ahoppen commented 1 month ago

When enumerating through a directory using FileManager.enumerator(at:) and one of the paths in that directory exceeds Window’s maximum path length of 260 characters, the enumerator silently stops. I’m not sure what I would expect but I think I would expect it to maybe skip the files that exceed the path length, not to stop enumeration altogether.

jakepetroules commented 1 month ago

Also, paths greater than 260 characters are allowed when long path support is enabled, and I think PathRelativePathTo has bugs which cause it to work improperly with long paths, so we should probably be using a different API.