mkdir; remove; under Windows throw Exception
unDEFER via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Dec 9 19:47:59 PST 2016
On Saturday, 10 December 2016 at 03:36:11 UTC, Adam D. Ruppe
wrote:
> On Saturday, 10 December 2016 at 03:29:18 UTC, unDEFER wrote:
>> But it works under Linux
>
> That's just because the underlying C function handles the case.
> But the D function makes no promises about that:
> std.file.remove's documentation says "removes the file",
> leaving what it does to directories undefined.
>
> Interestingly, the Linux kernel *does* make the distinction:
> the C remove function on Linux does a test then calls unlink or
> rmdir based on if it is a directory or not. But it didn't
> always do that.
>
> But what you have is undefined behavior - the function is only
> guaranteed to work on files, and does not specify if it will
> work or be an error on directories.
Thank you, but I think in this case D must use unlink for
implementation remove.
More information about the Digitalmars-d-learn
mailing list