| ... | @@ -1624,7 +1624,7 @@ pub const Dir = struct { | ... | @@ -1624,7 +1624,7 @@ pub const Dir = struct { |
| 1624 | pub fn openDirZ(self: Dir, sub_path_c: [*:0]const u8, args: OpenDirOptions, iterable: bool) OpenError!Dir { | 1624 | pub fn openDirZ(self: Dir, sub_path_c: [*:0]const u8, args: OpenDirOptions, iterable: bool) OpenError!Dir { |
| 1625 | if (builtin.os.tag == .windows) { | 1625 | if (builtin.os.tag == .windows) { |
| 1626 | const sub_path_w = try os.windows.cStrToPrefixedFileW(sub_path_c); | 1626 | const sub_path_w = try os.windows.cStrToPrefixedFileW(sub_path_c); |
| 1627 | return self.openDirW(sub_path_w.span().ptr, args); | 1627 | return self.openDirW(sub_path_w.span().ptr, args, iterable); |
| 1628 | } | 1628 | } |
| 1629 | const symlink_flags: u32 = if (args.no_follow) os.O.NOFOLLOW else 0x0; | 1629 | const symlink_flags: u32 = if (args.no_follow) os.O.NOFOLLOW else 0x0; |
| 1630 | if (!iterable) { | 1630 | if (!iterable) { |
| ... | @@ -2370,6 +2370,33 @@ pub fn openDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptio | ... | @@ -2370,6 +2370,33 @@ pub fn openDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptio |
| 2370 | return cwd().openDirW(absolute_path_c, flags); | 2370 | return cwd().openDirW(absolute_path_c, flags); |
| 2371 | } | 2371 | } |
| 2372 | | 2372 | |
| | 2373 | /// Opens a directory at the given path. The directory is a system resource that remains |
| | 2374 | /// open until `close` is called on the result. |
| | 2375 | /// See `openIterableDirAbsoluteZ` for a function that accepts a null-terminated path. |
| | 2376 | /// |
| | 2377 | /// Asserts that the path parameter has no null bytes. |
| | 2378 | pub fn openIterableDirAbsolute(absolute_path: []const u8, flags: Dir.OpenDirOptions) File.OpenError!IterableDir { |
| | 2379 | assert(path.isAbsolute(absolute_path)); |
| | 2380 | return cwd().openIterableDir(absolute_path, flags); |
| | 2381 | } |
| | 2382 | |
| | 2383 | /// Same as `openIterableDirAbsolute` but the path parameter is null-terminated. |
| | 2384 | pub fn openIterableDirAbsoluteZ(absolute_path_c: [*:0]const u8, flags: Dir.OpenDirOptions) File.OpenError!IterableDir { |
| | 2385 | assert(path.isAbsoluteZ(absolute_path_c)); |
| | 2386 | return IterableDir{ .dir = try cwd().openDirZ(absolute_path_c, flags, true) }; |
| | 2387 | } |
| | 2388 | /// Same as `openIterableDirAbsolute` but the path parameter is null-terminated. |
| | 2389 | pub fn openIterableDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptions) File.OpenError!IterableDir { |
| | 2390 | assert(path.isAbsoluteWindowsW(absolute_path_c)); |
| | 2391 | return IterableDir{ .dir = try cwd().openDirW(absolute_path_c, flags, true) }; |
| | 2392 | } |
| | 2393 | |
| | 2394 | comptime { |
| | 2395 | _ = openIterableDirAbsolute; |
| | 2396 | _ = openIterableDirAbsoluteZ; |
| | 2397 | _ = openIterableDirAbsoluteW; |
| | 2398 | } |
| | 2399 | |
| 2373 | /// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path. | 2400 | /// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path. |
| 2374 | /// Call `File.close` to release the resource. | 2401 | /// Call `File.close` to release the resource. |
| 2375 | /// Asserts that the path is absolute. See `Dir.openFile` for a function that | 2402 | /// Asserts that the path is absolute. See `Dir.openFile` for a function that |