[GHC] #13373: Handle long file paths on Windows
GHC
ghc-devs at haskell.org
Mon Mar 6 06:15:36 UTC 2017
#13373: Handle long file paths on Windows
-------------------------------------+-------------------------------------
Reporter: ezyang | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: libraries/base | Version: 8.1
Resolution: | Keywords:
Operating System: Windows | Architecture:
| Unknown/Multiple
Type of failure: None/Unknown | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by Rufflewind):
Turns out, despite what [https://msdn.microsoft.com/en-
us/library/windows/desktop/aa365530.aspx MSDN] says,
`SetCurrentDirectoryW` does not seem to support long paths through the
`\\?\` prefix. I saw an [https://news.ycombinator.com/item?id=13093529
anecdote] that it ''does'' work if one opts-in through the Win10-only
feature (through manifest and/or (?) registry tweak), as long as you
append a backslash. Since it still did not work with the `\\?\` prefix
even after appending a backslash, so I can only assume that `\\?\` is
broken for `SetCurrentDirectoryW`, but the registry/manifest tweak likely
does work. My guess is that because in the past `SetCurrentDirectoryW`
never supported `\\?\` to begin with, when they added the Win10 feature,
whoever updated the documentation probably copy-pasted that section
throughout and forgot that `\\?\` was ''specifically not enabled'' for
`SetCurrentDirectoryW` unlike many other functions, likely because it
would make the counterpart `GetCurrentDirectoryW` risky for improperly
written programs.
TL;DR: It does not seem possible to set the current directory to a long
path except through the Win-10 only mechanism.
Also, a lot of Windows functions will choke on relative paths if the
resulting path becomes too long, so users will have to use exclusively
`\\?\`-style absolute paths.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/13373#comment:6>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list