| ... | ... | @@ -740,7 +740,7 @@ pub const Walker = struct { |
| 740 | 740 | |
| 741 | 741 | /// Recursively iterates over a directory. |
| 742 | 742 | /// |
| 743 | | /// `self` must have been opened with `OpenDirOptions{.iterate = true}`. |
| 743 | /// `self` must have been opened with `OpenOptions{.iterate = true}`. |
| 744 | 744 | /// |
| 745 | 745 | /// `Walker.deinit` releases allocated memory and directory handles. |
| 746 | 746 | /// |
| ... | ... | @@ -1233,7 +1233,7 @@ fn makeOpenPathAccessMaskW(self: Dir, sub_path: []const u8, access_mask: u32, no |
| 1233 | 1233 | /// On Windows, `sub_path` should be encoded as [WTF-8](https://simonsapin.github.io/wtf-8/). |
| 1234 | 1234 | /// On WASI, `sub_path` should be encoded as valid UTF-8. |
| 1235 | 1235 | /// On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding. |
| 1236 | | pub fn makeOpenPath(self: Dir, sub_path: []const u8, open_dir_options: OpenDirOptions) (MakeError || OpenError || StatFileError)!Dir { |
| 1236 | pub fn makeOpenPath(self: Dir, sub_path: []const u8, open_dir_options: OpenOptions) (MakeError || OpenError || StatFileError)!Dir { |
| 1237 | 1237 | return switch (native_os) { |
| 1238 | 1238 | .windows => { |
| 1239 | 1239 | const w = windows; |
| ... | ... | @@ -1393,7 +1393,10 @@ pub fn setAsCwd(self: Dir) !void { |
| 1393 | 1393 | try posix.fchdir(self.fd); |
| 1394 | 1394 | } |
| 1395 | 1395 | |
| 1396 | | pub const OpenDirOptions = struct { |
| 1396 | /// Deprecated: use `OpenOptions` |
| 1397 | pub const OpenDirOptions = OpenOptions; |
| 1398 | |
| 1399 | pub const OpenOptions = struct { |
| 1397 | 1400 | /// `true` means the opened directory can be used as the `Dir` parameter |
| 1398 | 1401 | /// for functions which operate based on an open directory handle. When `false`, |
| 1399 | 1402 | /// such operations are Illegal Behavior. |
| ... | ... | @@ -1415,7 +1418,7 @@ pub const OpenDirOptions = struct { |
| 1415 | 1418 | /// On WASI, `sub_path` should be encoded as valid UTF-8. |
| 1416 | 1419 | /// On other platforms, `sub_path` is an opaque sequence of bytes with no particular encoding. |
| 1417 | 1420 | /// Asserts that the path parameter has no null bytes. |
| 1418 | | pub fn openDir(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError!Dir { |
| 1421 | pub fn openDir(self: Dir, sub_path: []const u8, args: OpenOptions) OpenError!Dir { |
| 1419 | 1422 | switch (native_os) { |
| 1420 | 1423 | .windows => { |
| 1421 | 1424 | const sub_path_w = try windows.sliceToPrefixedFileW(self.fd, sub_path); |
| ... | ... | @@ -1473,7 +1476,7 @@ pub fn openDir(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError! |
| 1473 | 1476 | } |
| 1474 | 1477 | |
| 1475 | 1478 | /// Same as `openDir` except the parameter is null-terminated. |
| 1476 | | pub fn openDirZ(self: Dir, sub_path_c: [*:0]const u8, args: OpenDirOptions) OpenError!Dir { |
| 1479 | pub fn openDirZ(self: Dir, sub_path_c: [*:0]const u8, args: OpenOptions) OpenError!Dir { |
| 1477 | 1480 | switch (native_os) { |
| 1478 | 1481 | .windows => { |
| 1479 | 1482 | const sub_path_w = try windows.cStrToPrefixedFileW(self.fd, sub_path_c); |
| ... | ... | @@ -1530,7 +1533,7 @@ pub fn openDirZ(self: Dir, sub_path_c: [*:0]const u8, args: OpenDirOptions) Open |
| 1530 | 1533 | |
| 1531 | 1534 | /// Same as `openDir` except the path parameter is WTF-16 LE encoded, NT-prefixed. |
| 1532 | 1535 | /// This function asserts the target OS is Windows. |
| 1533 | | pub fn openDirW(self: Dir, sub_path_w: [*:0]const u16, args: OpenDirOptions) OpenError!Dir { |
| 1536 | pub fn openDirW(self: Dir, sub_path_w: [*:0]const u16, args: OpenOptions) OpenError!Dir { |
| 1534 | 1537 | const w = windows; |
| 1535 | 1538 | // TODO remove some of these flags if args.access_sub_paths is false |
| 1536 | 1539 | const base_flags = w.STANDARD_RIGHTS_READ | w.FILE_READ_ATTRIBUTES | w.FILE_READ_EA | |
| ... | ... | @@ -2650,7 +2653,7 @@ pub const ChmodError = File.ChmodError; |
| 2650 | 2653 | /// The process must have the correct privileges in order to do this |
| 2651 | 2654 | /// successfully, or must have the effective user ID matching the owner |
| 2652 | 2655 | /// of the directory. Additionally, the directory must have been opened |
| 2653 | | /// with `OpenDirOptions{ .iterate = true }`. |
| 2656 | /// with `OpenOptions{ .iterate = true }`. |
| 2654 | 2657 | pub fn chmod(self: Dir, new_mode: File.Mode) ChmodError!void { |
| 2655 | 2658 | const file: File = .{ .handle = self.fd }; |
| 2656 | 2659 | try file.chmod(new_mode); |
| ... | ... | @@ -2660,7 +2663,7 @@ pub fn chmod(self: Dir, new_mode: File.Mode) ChmodError!void { |
| 2660 | 2663 | /// The process must have the correct privileges in order to do this |
| 2661 | 2664 | /// successfully. The group may be changed by the owner of the directory to |
| 2662 | 2665 | /// any group of which the owner is a member. Additionally, the directory |
| 2663 | | /// must have been opened with `OpenDirOptions{ .iterate = true }`. If the |
| 2666 | /// must have been opened with `OpenOptions{ .iterate = true }`. If the |
| 2664 | 2667 | /// owner or group is specified as `null`, the ID is not changed. |
| 2665 | 2668 | pub fn chown(self: Dir, owner: ?File.Uid, group: ?File.Gid) ChownError!void { |
| 2666 | 2669 | const file: File = .{ .handle = self.fd }; |