std.utf.toUTF16z and windows unicode path limits

Walter Bright newshound2 at digitalmars.com
Mon Mar 17 18:50:37 PDT 2014


I didn't know this. Please file a bugzilla enhancement request for it, and we'll 
see about fixing it.

On 3/17/2014 6:34 PM, Jay Norwood wrote:
> 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