diff options
| author | Ryan Liptak <squeek502@hotmail.com> | 2020-09-16 20:59:45 -0700 |
|---|---|---|
| committer | Andrew Kelley <andrew@ziglang.org> | 2020-09-17 17:22:26 -0400 |
| commit | 5e3fa0e94f947c632aa584b9e13bfa2fe241fae1 (patch) | |
| tree | d2361876d4a8bfe9e5ffab6fc7db81ad33d6ec73 /lib/std/os.zig | |
| parent | 3672a187999c3db6eba35d9a9184e7cc066ed629 (diff) | |
| download | zig-5e3fa0e94f947c632aa584b9e13bfa2fe241fae1.tar.gz zig-5e3fa0e94f947c632aa584b9e13bfa2fe241fae1.zip | |
Add rename to std.fs API
- Moves fs.rename functions to fs.renameAbsolute to match other functions outside of fs.Dir
- Adds fs.Dir.rename that takes two paths relative to the given Dir
- Adds fs.rename that takes two separate Dir's that the given paths are relative to (for renaming across directories without having to make the second path relative to a single directory)
- Fixes FileNotFound error return in std.os.windows.MoveFileExW
- Returns error.RenameAcrossMountPoints from renameatW
+ Matches the RenameAcrossMountPoints error return in renameatWasi/renameatZ
Diffstat (limited to 'lib/std/os.zig')
| -rw-r--r-- | lib/std/os.zig | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/lib/std/os.zig b/lib/std/os.zig index bdc746419a..7fc63d7853 100644 --- a/lib/std/os.zig +++ b/lib/std/os.zig @@ -1890,7 +1890,7 @@ pub fn unlinkatW(dirfd: fd_t, sub_path_w: []const u16, flags: u32) UnlinkatError return windows.DeleteFile(sub_path_w, .{ .dir = dirfd, .remove_dir = remove_dir }); } -const RenameError = error{ +pub const RenameError = error{ /// In WASI, this error may occur when the file descriptor does /// not hold the required rights to rename a resource by path relative to it. AccessDenied, @@ -2107,6 +2107,7 @@ pub fn renameatW( .ACCESS_DENIED => return error.AccessDenied, .OBJECT_NAME_NOT_FOUND => return error.FileNotFound, .OBJECT_PATH_NOT_FOUND => return error.FileNotFound, + .NOT_SAME_DEVICE => error.RenameAcrossMountPoints, else => return windows.unexpectedStatus(rc), } } |
