When ./dir is non-empty, the following code will succeed but the directory will not be deleted. I expect error.DirNotEmpty to be returned in this case.
conststd=@import("std");
pubfnmain() !void {
returnstd.fs.cwd().deleteDir("dir");
}Both NtCreateFile and NtClose seem to be returning SUCCESS here:
| varrc=w.ntdll.NtCreateFile( |
| &tmp_handle, |
| w.SYNCHRONIZE|w.DELETE, |
| &attr, |
| &io, |
| null, |
| 0, |
| w.FILE_SHARE_READ|w.FILE_SHARE_WRITE|w.FILE_SHARE_DELETE, |
| w.FILE_OPEN, |
| create_options_flags, |
| null, |
| 0, |
| ); |
| if (rc==.SUCCESS) { |
| rc=w.ntdll.NtClose(tmp_handle); |
| } |
| switch (rc) { |
| .SUCCESS=>return, |
| .OBJECT_NAME_INVALID=>unreachable, |
| .OBJECT_NAME_NOT_FOUND=>returnerror.FileNotFound, |
| .INVALID_PARAMETER=>unreachable, |
| .FILE_IS_A_DIRECTORY=>returnerror.IsDir, |
| else=>returnw.unexpectedStatus(rc), |
| } |
When
./diris non-empty, the following code will succeed but the directory will not be deleted. I expecterror.DirNotEmptyto be returned in this case.Both NtCreateFile and NtClose seem to be returning
SUCCESShere:zig/lib/std/os.zig
Lines 1768 to 1791 in fd067fb