errors with filesystem operations

Hugo Florentino hugo at acdam.cu
Mon Jan 20 03:30:08 PST 2014


On Sat, 18 Jan 2014 11:33:16 +0000, Kagamin wrote:
> On Friday, 17 January 2014 at 12:52:09 UTC, Hugo Florentino wrote:
>> On Fri, 17 Jan 2014 07:07:35 +0000, Kagamin wrote:
>>> Does it fail for that one directory only or for any directory?
>>
>> Interesting question. I would have to do more tests with odd names, 
>> but apparently both remove() and rename() have problems with 
>> directories with a blank name.
>
> In that case try a path with \\?\ prefix (unparsed path).


Does not work. I modified the relevant block like this:

   if (exists(BlankDirToDelete))
   {
     string SafeToBeDeleted = buildPath(`\\?\`, SearchPath, 
baseName(BlankDirToDelete));
     writefln(`"%s"`, SafeToBeDeleted);
     try
       remove(SafeToBeDeleted);
     catch (FileException e)
       writeln(e.msg);
     try
       remove(`\\?\` ~ SafeToBeDeleted);
     catch (FileException e)
       writeln(e.msg);
   }

The result?

"d:\ "
d:\ : Access denied.
\\?\d:\ : Access denied.

This happens even while executing the prompt as administrator, so it's 
not a problem of file privileges. Note that from the Windows explorer I 
am also having problems renaming or deleting the problematic directory, 
however with something else like Total Commander, I can both rename and 
delete with no issues.

Regards, Hugo


More information about the Digitalmars-d-learn mailing list