std.os: unlinkW shouldn't return error.DirNotEmpty

This commit is contained in:
Krzysztof Wolicki
2023-10-19 14:59:52 +02:00
committed by GitHub
parent fbbccc9d5f
commit 530dc0405c

View File

@@ -2355,7 +2355,10 @@ pub fn unlinkZ(file_path: [*:0]const u8) UnlinkError!void {
/// Windows-only. Same as `unlink` except the parameter is null-terminated, WTF16 encoded.
pub fn unlinkW(file_path_w: []const u16) UnlinkError!void {
return windows.DeleteFile(file_path_w, .{ .dir = std.fs.cwd().fd });
windows.DeleteFile(file_path_w, .{ .dir = std.fs.cwd().fd }) catch |err| switch (err) {
error.DirNotEmpty => unreachable, // we're not passing .remove_dir = true
else => |e| return e,
};
}
pub const UnlinkatError = UnlinkError || error{