@@ -1624,7 +1624,7 @@ pub const Dir = struct {
16241624 pub fn openDirZ (self : Dir , sub_path_c : [* :0 ]const u8 , args : OpenDirOptions , iterable : bool ) OpenError ! Dir {
16251625 if (builtin .os .tag == .windows ) {
16261626 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 );
16281628 }
16291629 const symlink_flags : u32 = if (args .no_follow ) os .O .NOFOLLOW else 0x0 ;
16301630 if (! iterable ) {
@@ -2370,6 +2370,33 @@ pub fn openDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptio
23702370 return cwd ().openDirW (absolute_path_c , flags );
23712371}
23722372
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+
23732400/// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path.
23742401/// Call `File.close` to release the resource.
23752402/// Asserts that the path is absolute. See `Dir.openFile` for a function that
0 commit comments