fix(windows): Fs.remove removes an empty directory, as POSIX remove does

The UCRT's remove() deletes files only, so a tree removed bottom-up left every
directory behind. emit_win defines remove over DeleteFileA, falling back to
RemoveDirectoryA. Found by Maroon Lake's selftest26 ("1 left behind"), which now
passes on Windows with the rest of that game's self-tests.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Orkun ÇAKILKAYA 2026-09-13 02:27:21 +03:00
parent cb05721a89
commit 1bc255bc40
3 changed files with 13458 additions and 13433 deletions

View file

@ -91,8 +91,8 @@ function emit_mime_ns(meth: pointer, e: Node) -> Val {
# emit_fs_prelude — the Fs/Path/Mime runtime, emitted once per program that uses
# any of the three namespaces (g_uses_fsrt). Pure libc + byte IR.
function emit_fs_prelude() -> void {
emith("declare i32 @remove(ptr)\n")
if not g_target_win { # defined by emit_win_prelude on Windows
emith("declare i32 @remove(ptr)\n")
emith("declare i32 @access(ptr, i32)\n")
emith("declare i32 @mkdir(ptr, i32)\n")
emith("declare i32 @rename(ptr, ptr)\n")