| ... | @@ -1602,6 +1602,14 @@ pub const Dir = struct { | ... | @@ -1602,6 +1602,14 @@ pub const Dir = struct { |
| 1602 | if (builtin.os.tag == .wasi) { | 1602 | if (builtin.os.tag == .wasi) { |
| 1603 | @compileError("changing cwd is not currently possible in WASI"); | 1603 | @compileError("changing cwd is not currently possible in WASI"); |
| 1604 | } | 1604 | } |
| | 1605 | if (builtin.os.tag == .windows) { |
| | 1606 | var dir_path_buffer: [os.windows.PATH_MAX_WIDE]u16 = undefined; |
| | 1607 | var dir_path = try os.windows.GetFinalPathNameByHandle(self.fd, .{}, &dir_path_buffer); |
| | 1608 | if (builtin.link_libc) { |
| | 1609 | return os.chdirW(dir_path); |
| | 1610 | } |
| | 1611 | return os.windows.SetCurrentDirectory(dir_path); |
| | 1612 | } |
| 1605 | try os.fchdir(self.fd); | 1613 | try os.fchdir(self.fd); |
| 1606 | } | 1614 | } |
| 1607 | | 1615 | |