May 10, 2023
https://issues.dlang.org/show_bug.cgi?id=23910

          Issue ID: 23910
           Summary: std.file.remove acts differently on Windows and Linux
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P1
         Component: phobos
          Assignee: nobody@puremagic.com
          Reporter: post@larskyllingstad.no

On Windows, std.file.remove calls DeleteFileW, which can only delete regular
files.  On POSIX, it calls remove(3), which can remove both files and (empty)
directories.

Depending on how we *want* it to work, it should conditionally call DeleteFileW or RemoveDirectoryW on Windows, or it should call unlink(2) on POSIX. The former solution is far less of a breaking change, but the breakage is more subtle and silent.

--