| ... | @@ -828,7 +828,9 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil | ... | @@ -828,7 +828,9 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil |
| 828 | else => return unexpectedStatus(rc), | 828 | else => return unexpectedStatus(rc), |
| 829 | } | 829 | } |
| 830 | | 830 | |
| 831 | if (options.remove_dir){ | 831 | // If a directory fails to be deleted, CloseHandle will still report success |
| | 832 | // Check if the directory still exists and return error.DirNotEmpty if true |
| | 833 | if (options.remove_dir) { |
| 832 | var basic_info: FILE_BASIC_INFORMATION = undefined; | 834 | var basic_info: FILE_BASIC_INFORMATION = undefined; |
| 833 | switch (ntdll.NtQueryAttributesFile(&attr, &basic_info)) { | 835 | switch (ntdll.NtQueryAttributesFile(&attr, &basic_info)) { |
| 834 | .SUCCESS => return error.DirNotEmpty, | 836 | .SUCCESS => return error.DirNotEmpty, |