From a11cdb6a34de8820826e49ba54459c3abd4aca4e Mon Sep 17 00:00:00 2001 From: Ryan Liptak Date: Sat, 19 Aug 2023 12:44:39 -0700 Subject: [PATCH] os.realpathW: Reduce the number of OpenFile calls for directories Same as a190582b26a82f96da7488eff37e9676cdb937bc but for os.realpathW instead of fs.Dir.realpathW --- lib/std/os.zig | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/lib/std/os.zig b/lib/std/os.zig index e4ac38051e..f2b2393b54 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -5149,18 +5149,8 @@ pub fn realpathW(pathname: []const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPat .share_access = share_access, .creation = creation, .io_mode = .blocking, + .filter = .any, }) catch |err| switch (err) { - error.IsDir => break :blk w.OpenFile(pathname, .{ - .dir = dir, - .access_mask = access_mask, - .share_access = share_access, - .creation = creation, - .io_mode = .blocking, - .filter = .dir_only, - }) catch |er| switch (er) { - error.WouldBlock => unreachable, - else => |e2| return e2, - }, error.WouldBlock => unreachable, else => |e| return e, };