remove file access denied(remove broke)
Josphe Brigmo
JospheBrigmo at gmail.com
Sat Sep 15 10:09:43 UTC 2018
On Saturday, 15 September 2018 at 06:13:29 UTC, bauss wrote:
> On Friday, 14 September 2018 at 16:55:21 UTC, Josphe Brigmo
> wrote:
>> On Friday, 14 September 2018 at 15:21:21 UTC, H. S. Teoh wrote:
>>> [...]
>>
>> It woudln't help. I'm dealing with over a million files and
>> you'd need those files too.
>>
>> But basically all I have done is created a new rename function:
>>
>> void removeFile(string fn)
>> {
>> if (!isDir(fn))
>> {
>> // remove(fn)
>> setAttributes(fn, 0x80);
>> auto ls = executeShell(`del /F /Q "`~fn~`"`);
>> if (ls.status != 0) throw new Exception("Cannot delete file
>> `"~fn~"`!");
>> }
>> }
>>
>> And this works and functions appropriately.
>>
>> The other code is basically just recursively going through the
>> directory as standard practice using dirEntries and deleting
>> certain files(it's a little more complex since there is some
>> logic on the file name, but nothing touches the file except
>> delete).
>
> Went ahead and did the following in case anyone comes across
> your issue in the future:
>
> https://github.com/dlang/phobos/pull/6707
>
> That way the documentation will at least be clear about it.
Thanks. The problem ultimately is MAX_PATH.
Seems that phobo's does not detect windows 10 nor use unicode for
such things as it should which would not break simple code(one
expects file routines to be well used and the bugs fixed). Seems
not to many people use D for windows with long paths and files
and hence D for windows.
The fix is relatively simple ("prepend \\?\ or use the wide
functions).
More information about the Digitalmars-d-learn
mailing list