-
Notifications
You must be signed in to change notification settings - Fork 10
Description
openFile from this package appears that it will fail on Windows if a filename is longer than 285 characters or so, which is a default limit in Windows. This is surprising, because openFile from base has for several years avoided that length limitation. So a program that is able to operate on long filenames on windows, if converted from base to file-io, will subtly break.
The openFile implementation here calls directly through to createFile from Win32. Win32 is a direct mapping to the win32 api, which has this filename length limitation.
To avoid the length limitation, base's openFile converts the path to a "UNC-style" path first. That conversion is how ghc is generally supporting long filenames on windows. See create_device_name in ghc's utils/fs/fs.c. And other libraries do too. directory-1.3.9.0 contains furnishPath :: OsPath -> IO WindowsPath which I think could be used in file-io as well to relatively easily fix this.
(Note that I have not actually verified this by running openFile on windows, only by inspection. I suspect other functions like withFile have the same problem too, but have not checked.)