The documentation for GetFullPathName()
says that in order to use paths longer than MAX_PATH
(260 characters) I need to prepend the file namespace prefix: \\?\
. However, the general documentation on file names says that this prefix cannot be used with relative paths and thus a relative path's length is always limited to 260 characters. Does this mean there's no way to use GetFullPathName()
with a relative path longer than MAX_PATH
? (If so, then my understanding is that the function does not really support long paths unless the passed path is already a full one.)
Agreed, that's nonsensical. The native api has no concept of relative paths, it is a pure winapi layer feature. It could be interpreted as a way to get the function to return the native path name. But it doesn't, I checked. Looks like a copy/paste doc bug.
Do keep your eye on the ball, when you need GetFullPathName() then you already lost anyway. Because GetCurrentDirectory() is already subject to the MAX_PATH limit. So long path support is already out of the window.
The generic advice is to never rely on relative paths, even if you don't care about long path support. Way too many accidents. With the only reasonable opt-out if you want to write a simple console mode app that is expected to be driven from the command line. And then you don't care because the command line interpreter is MAX_PATH encumbered.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With