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.

Reply via email to