authorgravatar for der.teufel.mail@gmail.comKrzysztof Wolicki <der.teufel.mail@gmail.com> 2024-01-30 03:19:07+01:00
committergravatar for noreply@github.comGitHub <noreply@github.com> 2024-01-29 21:19:07-05:00
logd8981dc493aca64edc3a5c0130a722d86d55b6d9
tree24bc7f45828927180567a034b30900bc353ed37b
parent7d75c3d3b80c86bbd47e60f85a98e8decc52c611
signaturebadge-check Signed by PGP key B5690EEEBB952194

std.os: fix chdirZ to compile on Windows (#18695)


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

lib/std/os.zig+2-2
...@@ -3155,11 +3155,11 @@ pub fn chdir(dir_path: []const u8) ChangeCurDirError!void {...@@ -3155,11 +3155,11 @@ pub fn chdir(dir_path: []const u8) ChangeCurDirError!void {
3155pub fn chdirZ(dir_path: [*:0]const u8) ChangeCurDirError!void {3155pub fn chdirZ(dir_path: [*:0]const u8) ChangeCurDirError!void {
3156 if (builtin.os.tag == .windows) {3156 if (builtin.os.tag == .windows) {
3157 var utf16_dir_path: [windows.PATH_MAX_WIDE]u16 = undefined;3157 var utf16_dir_path: [windows.PATH_MAX_WIDE]u16 = undefined;
3158 const len = try std.unicode.utf8ToUtf16Le(utf16_dir_path[0..], dir_path);3158 const len = try std.unicode.utf8ToUtf16Le(utf16_dir_path[0..], mem.span(dir_path));
3159 if (len > utf16_dir_path.len) return error.NameTooLong;3159 if (len > utf16_dir_path.len) return error.NameTooLong;
3160 return chdirW(utf16_dir_path[0..len]);3160 return chdirW(utf16_dir_path[0..len]);
3161 } else if (builtin.os.tag == .wasi and !builtin.link_libc) {3161 } else if (builtin.os.tag == .wasi and !builtin.link_libc) {
3162 return chdir(mem.sliceTo(dir_path, 0));3162 return chdir(mem.span(dir_path));
3163 }3163 }
3164 switch (errno(system.chdir(dir_path))) {3164 switch (errno(system.chdir(dir_path))) {
3165 .SUCCESS => return,3165 .SUCCESS => return,