authorgravatar for squeek502@hotmail.comRyan Liptak <squeek502@hotmail.com> 2023-08-19 12:44:39-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-08-19 22:29:46-07:00
loga11cdb6a34de8820826e49ba54459c3abd4aca4e
treec0be886fa7ad0c06d577a67d30bcef68f4f419a5
parent4c97919e8e032a91e45d44ee438c9f00d16f52a4

os.realpathW: Reduce the number of OpenFile calls for directories

Same as a190582b26a82f96da7488eff37e9676cdb937bc but for os.realpathW instead of fs.Dir.realpathW

1 files changed, 1 insertions(+), 11 deletions(-)

lib/std/os.zig+1-11
......@@ -5149,18 +5149,8 @@ pub fn realpathW(pathname: []const u16, out_buffer: *[MAX_PATH_BYTES]u8) RealPat
51495149 .share_access = share_access,
51505150 .creation = creation,
51515151 .io_mode = .blocking,
5152 .filter = .any,
51525153 }) catch |err| switch (err) {
5153 error.IsDir => break :blk w.OpenFile(pathname, .{
5154 .dir = dir,
5155 .access_mask = access_mask,
5156 .share_access = share_access,
5157 .creation = creation,
5158 .io_mode = .blocking,
5159 .filter = .dir_only,
5160 }) catch |er| switch (er) {
5161 error.WouldBlock => unreachable,
5162 else => |e2| return e2,
5163 },
51645154 error.WouldBlock => unreachable,
51655155 else => |e| return e,
51665156 };