std.utf.toUTF16z and windows unicode path limits
Jay Norwood
jayn at prismnet.com
Mon Mar 17 18:34:43 PDT 2014
I ran into a problem with the std.file.remove() operation being
limited by the windows ascii maxpath of around 260 characters,
even though the low level code is calling the unicode version of
windows delete, which has the capability to go up to 32k. The
trick appears to be that the unicode api calls still need "\\?\"
prepended to the string in order to extend the path limit to 32K.
There is some discussion of it at this link.
http://msdn.microsoft.com/en-us/library/windows/desktop/aa363915(v=vs.85).aspx
So, I wonder if it would be appropriate to update this
std.utf.toUTF16z, or else create a new version that does the
prepending correctly if the path provided exceeds the relatively
small MAX_PATH limit.
We might also want to re-examine MAX_PATH use elsewhere in the
code, since windows can supposedly support the 32K paths through
use of the unicode versions of the calls, which the std.file
methods are using.
void remove(in char[] name)
{
version(Windows)
{
cenforce(DeleteFileW(std.utf.toUTF16z(name)), name);
}
More information about the Digitalmars-d
mailing list