@@ -764,7 +764,6 @@ pub const DeleteFileError = error{
764
764
Unexpected ,
765
765
NotDir ,
766
766
IsDir ,
767
- DirNotEmpty ,
768
767
};
769
768
770
769
pub const DeleteFileOptions = struct {
@@ -819,29 +818,14 @@ pub fn DeleteFile(sub_path_w: []const u16, options: DeleteFileOptions) DeleteFil
819
818
0 ,
820
819
);
821
820
switch (rc ) {
822
- .SUCCESS = > CloseHandle (tmp_handle ),
821
+ .SUCCESS = > return CloseHandle (tmp_handle ),
823
822
.OBJECT_NAME_INVALID = > unreachable ,
824
823
.OBJECT_NAME_NOT_FOUND = > return error .FileNotFound ,
825
824
.INVALID_PARAMETER = > unreachable ,
826
825
.FILE_IS_A_DIRECTORY = > return error .IsDir ,
827
826
.NOT_A_DIRECTORY = > return error .NotDir ,
828
827
else = > return unexpectedStatus (rc ),
829
828
}
830
-
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 ) {
834
- var basic_info : FILE_BASIC_INFORMATION = undefined ;
835
- switch (ntdll .NtQueryAttributesFile (& attr , & basic_info )) {
836
- .SUCCESS = > return error .DirNotEmpty ,
837
- .OBJECT_NAME_NOT_FOUND = > return ,
838
- .OBJECT_PATH_NOT_FOUND = > return ,
839
- .INVALID_PARAMETER = > unreachable ,
840
- .ACCESS_DENIED = > return error .AccessDenied ,
841
- .OBJECT_PATH_SYNTAX_BAD = > unreachable ,
842
- else = > | urc | return unexpectedStatus (urc ),
843
- }
844
- }
845
829
}
846
830
847
831
pub const MoveFileError = error { FileNotFound , Unexpected };
0 commit comments