add missing error code for DeleteFileW

This commit is contained in:
Andrew Kelley 2019-06-26 14:32:19 -04:00
parent 33f996bb16
commit 5cd4753bea
2 changed files with 6 additions and 1 deletions

View File

@ -597,7 +597,10 @@ test "c out stream" {
const filename = c"tmp_io_test_file.txt";
const out_file = std.c.fopen(filename, c"w") orelse return error.UnableToOpenTestFile;
defer fs.deleteFileC(filename) catch {};
defer {
_ = std.c.fclose(out_file);
fs.deleteFileC(filename) catch {};
}
const out_stream = &io.COutStream.init(out_file).stream;
try out_stream.print("hi: {}\n", i32(123));

View File

@ -348,6 +348,7 @@ pub const DeleteFileError = error{
FileNotFound,
AccessDenied,
NameTooLong,
FileBusy,
Unexpected,
};
@ -363,6 +364,7 @@ pub fn DeleteFileW(filename: [*]const u16) DeleteFileError!void {
ERROR.ACCESS_DENIED => return error.AccessDenied,
ERROR.FILENAME_EXCED_RANGE => return error.NameTooLong,
ERROR.INVALID_PARAMETER => return error.NameTooLong,
ERROR.SHARING_VIOLATION => return error.FileBusy,
else => |err| return unexpectedError(err),
}
}