mirror of
https://codeberg.org/ziglang/zig.git
synced 2025-12-06 05:44:20 +00:00
std.os: fix chdirZ to compile on Windows (#18695)
This commit is contained in:
parent
7d75c3d3b8
commit
d8981dc493
1 changed files with 2 additions and 2 deletions
|
|
@ -3155,11 +3155,11 @@ pub fn chdir(dir_path: []const u8) ChangeCurDirError!void {
|
|||
pub fn chdirZ(dir_path: [*:0]const u8) ChangeCurDirError!void {
|
||||
if (builtin.os.tag == .windows) {
|
||||
var utf16_dir_path: [windows.PATH_MAX_WIDE]u16 = undefined;
|
||||
const len = try std.unicode.utf8ToUtf16Le(utf16_dir_path[0..], dir_path);
|
||||
const len = try std.unicode.utf8ToUtf16Le(utf16_dir_path[0..], mem.span(dir_path));
|
||||
if (len > utf16_dir_path.len) return error.NameTooLong;
|
||||
return chdirW(utf16_dir_path[0..len]);
|
||||
} else if (builtin.os.tag == .wasi and !builtin.link_libc) {
|
||||
return chdir(mem.sliceTo(dir_path, 0));
|
||||
return chdir(mem.span(dir_path));
|
||||
}
|
||||
switch (errno(system.chdir(dir_path))) {
|
||||
.SUCCESS => return,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue