diff options
| author | Lee Cannon <leecannon@leecannon.xyz> | 2020-11-07 11:55:55 +0000 |
|---|---|---|
| committer | Jakub Konka <kubkon@jakubkonka.com> | 2020-11-18 15:37:44 +0100 |
| commit | 32c998e03c38fabfb3f26ad7f88817ec8a8e5f6d (patch) | |
| tree | a62ddbdf336b426f0bf72764b918461faebe4b25 /lib/std/os.zig | |
| parent | 80b1e82b1b8706b7654560013751dd4a6fc8ae2a (diff) | |
| download | zig-32c998e03c38fabfb3f26ad7f88817ec8a8e5f6d.tar.gz zig-32c998e03c38fabfb3f26ad7f88817ec8a8e5f6d.zip | |
Switch to RtlSetCurrentDirectory_U
Diffstat (limited to 'lib/std/os.zig')
| -rw-r--r-- | lib/std/os.zig | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig index edb53ec6a3..cfa9c99643 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -2297,6 +2297,9 @@ pub const ChangeCurDirError = error{ FileNotFound, SystemResources, NotDir, + + /// On Windows, file paths must be valid Unicode. + InvalidUtf8, } || UnexpectedError; /// Changes the current working directory of the calling process. @@ -2306,9 +2309,12 @@ pub fn chdir(dir_path: []const u8) ChangeCurDirError!void { @compileError("chdir is not supported in WASI"); } else if (builtin.os.tag == .windows) { windows.SetCurrentDirectory(dir_path) catch |err| switch (err) { - error.PathNotFound, error.InvalidName, error.InvalidUtf8 => return error.FileNotFound, + error.InvalidUtf8 => return error.InvalidUtf8, error.NameTooLong => return error.NameTooLong, + error.FileNotFound => return error.FileNotFound, error.NotDir => return error.NotDir, + error.NoDevice => return error.FileSystem, + error.AccessDenied => return error.AccessDenied, error.Unexpected => return error.Unexpected, }; } else { |
