Commit 5cd4753bea

Andrew Kelley <andrew@ziglang.org>
2019-06-26 20:32:19
add missing error code for DeleteFileW
1 parent 33f996b
Changed files (2)
std/io/test.zig
@@ -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));
std/os/windows.zig
@@ -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),
         }
     }