From 43cd9eb110f6803f4e19d92347ebf263e6e644af Mon Sep 17 00:00:00 2001 From: Suirad Date: Fri, 25 Sep 2020 18:11:31 -0500 Subject: Add clarification comment --- lib/std/os/windows.zig | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'lib') diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig index c4037ccf0a..2aa222414f 100644 --- a/lib/std/os/windows.zig +++ b/lib/std/os/windows.zig @@ -828,7 +828,9 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil else => return unexpectedStatus(rc), } - if (options.remove_dir){ + // If a directory fails to be deleted, CloseHandle will still report success + // Check if the directory still exists and return error.DirNotEmpty if true + if (options.remove_dir) { var basic_info: FILE_BASIC_INFORMATION = undefined; switch (ntdll.NtQueryAttributesFile(&attr, &basic_info)) { .SUCCESS => return error.DirNotEmpty, -- cgit v1.2.3