authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-11-22 13:12:22-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2023-11-22 15:24:57-07:00
loge357550610aef476390ed7191eeaf7597a8e9d53
tree73b53ef2bd5cfb0fc185fc15d6ddcedd65e83eae
parent519ba9bb654a4d5caf7440160f018b7a3ae1e95a

update for the std.fs.Dir changes


11 files changed, 66 insertions(+), 57 deletions(-)

lib/std/Build/Step/InstallDir.zig+1-1
......@@ -69,7 +69,7 @@ fn make(step: *Step, prog_node: *std.Progress.Node) !void {
6969 const dest_prefix = dest_builder.getInstallPath(self.options.install_dir, self.options.install_subdir);
7070 const src_builder = self.step.owner;
7171 const src_dir_path = self.options.source_dir.getPath2(src_builder, step);
72 var src_dir = src_builder.build_root.handle.openIterableDir(src_dir_path, .{}) catch |err| {
72 var src_dir = src_builder.build_root.handle.openDir(src_dir_path, .{ .iterate = true }) catch |err| {
7373 return step.fail("unable to open source directory '{}{s}': {s}", .{
7474 src_builder.build_root, src_dir_path, @errorName(err),
7575 });
lib/std/child_process.zig+2-1
......@@ -976,7 +976,8 @@ fn windowsCreateProcessPathExt(
976976 defer dir_buf.shrinkRetainingCapacity(dir_path_len);
977977 const dir_path_z = dir_buf.items[0 .. dir_buf.items.len - 1 :0];
978978 const prefixed_path = try windows.wToPrefixedFileW(null, dir_path_z);
979 break :dir fs.cwd().openDirW(prefixed_path.span().ptr, .{}, true) catch return error.FileNotFound;
979 break :dir fs.cwd().openDirW(prefixed_path.span().ptr, .{ .iterate = true }) catch
980 return error.FileNotFound;
980981 };
981982 defer dir.close();
982983
lib/std/crypto/Certificate/Bundle.zig+4-4
......@@ -160,7 +160,7 @@ pub fn addCertsFromDirPath(
160160 dir: fs.Dir,
161161 sub_dir_path: []const u8,
162162) AddCertsFromDirPathError!void {
163 var iterable_dir = try dir.openIterableDir(sub_dir_path, .{});
163 var iterable_dir = try dir.openDir(sub_dir_path, .{ .iterate = true });
164164 defer iterable_dir.close();
165165 return addCertsFromDir(cb, gpa, iterable_dir);
166166}
......@@ -171,14 +171,14 @@ pub fn addCertsFromDirPathAbsolute(
171171 abs_dir_path: []const u8,
172172) AddCertsFromDirPathError!void {
173173 assert(fs.path.isAbsolute(abs_dir_path));
174 var iterable_dir = try fs.openIterableDirAbsolute(abs_dir_path, .{});
174 var iterable_dir = try fs.openDirAbsolute(abs_dir_path, .{ .iterate = true });
175175 defer iterable_dir.close();
176176 return addCertsFromDir(cb, gpa, iterable_dir);
177177}
178178
179179pub const AddCertsFromDirError = AddCertsFromFilePathError;
180180
181pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, iterable_dir: fs.IterableDir) AddCertsFromDirError!void {
181pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, iterable_dir: fs.Dir) AddCertsFromDirError!void {
182182 var it = iterable_dir.iterate();
183183 while (try it.next()) |entry| {
184184 switch (entry.kind) {
......@@ -186,7 +186,7 @@ pub fn addCertsFromDir(cb: *Bundle, gpa: Allocator, iterable_dir: fs.IterableDir
186186 else => continue,
187187 }
188188
189 try addCertsFromFilePath(cb, gpa, iterable_dir.dir, entry.name);
189 try addCertsFromFilePath(cb, gpa, iterable_dir, entry.name);
190190 }
191191}
192192
lib/std/fs.zig+5-5
......@@ -1653,12 +1653,12 @@ pub const Dir = struct {
16531653 pub fn openDir(self: Dir, sub_path: []const u8, args: OpenDirOptions) OpenError!Dir {
16541654 if (builtin.os.tag == .windows) {
16551655 const sub_path_w = try os.windows.sliceToPrefixedFileW(self.fd, sub_path);
1656 return .{ .dir = try self.openDirW(sub_path_w.span().ptr, args) };
1656 return self.openDirW(sub_path_w.span().ptr, args);
16571657 } else if (builtin.os.tag == .wasi and !builtin.link_libc) {
1658 return .{ .dir = try self.openDirWasi(sub_path, args) };
1658 return self.openDirWasi(sub_path, args);
16591659 } else {
16601660 const sub_path_c = try os.toPosixPath(sub_path);
1661 return .{ .dir = try self.openDirZ(&sub_path_c, args) };
1661 return self.openDirZ(&sub_path_c, args);
16621662 }
16631663 }
16641664
......@@ -2784,12 +2784,12 @@ pub fn openDirAbsolute(absolute_path: []const u8, flags: Dir.OpenDirOptions) Fil
27842784/// Same as `openDirAbsolute` but the path parameter is null-terminated.
27852785pub fn openDirAbsoluteZ(absolute_path_c: [*:0]const u8, flags: Dir.OpenDirOptions) File.OpenError!Dir {
27862786 assert(path.isAbsoluteZ(absolute_path_c));
2787 return cwd().openDirZ(absolute_path_c, flags, false);
2787 return cwd().openDirZ(absolute_path_c, flags);
27882788}
27892789/// Same as `openDirAbsolute` but the path parameter is null-terminated.
27902790pub fn openDirAbsoluteW(absolute_path_c: [*:0]const u16, flags: Dir.OpenDirOptions) File.OpenError!Dir {
27912791 assert(path.isAbsoluteWindowsW(absolute_path_c));
2792 return cwd().openDirW(absolute_path_c, flags, false);
2792 return cwd().openDirW(absolute_path_c, flags);
27932793}
27942794
27952795/// Opens a file for reading or writing, without attempting to create a new file, based on an absolute path.
lib/std/fs/test.zig+18-20
......@@ -72,9 +72,8 @@ const PathType = enum {
7272const TestContext = struct {
7373 path_type: PathType,
7474 arena: ArenaAllocator,
75 tmp: testing.TmpIterableDir,
75 tmp: testing.TmpDir,
7676 dir: std.fs.Dir,
77 iterable_dir: std.fs.Dir,
7877 transform_fn: *const PathType.TransformFn,
7978
8079 pub fn init(path_type: PathType, allocator: mem.Allocator, transform_fn: *const PathType.TransformFn) TestContext {
......@@ -83,8 +82,7 @@ const TestContext = struct {
8382 .path_type = path_type,
8483 .arena = ArenaAllocator.init(allocator),
8584 .tmp = tmp,
86 .dir = tmp.iterable_dir.dir,
87 .iterable_dir = tmp.iterable_dir,
85 .dir = tmp.dir,
8886 .transform_fn = transform_fn,
8987 };
9088 }
......@@ -359,7 +357,7 @@ test "Dir.Iterator many entries" {
359357 var buf: [4]u8 = undefined; // Enough to store "1024".
360358 while (i < num) : (i += 1) {
361359 const name = try std.fmt.bufPrint(&buf, "{}", .{i});
362 const file = try tmp_dir.iterable_dir.dir.createFile(name, .{});
360 const file = try tmp_dir.dir.createFile(name, .{});
363361 file.close();
364362 }
365363
......@@ -370,7 +368,7 @@ test "Dir.Iterator many entries" {
370368 var entries = std.ArrayList(Dir.Entry).init(allocator);
371369
372370 // Create iterator.
373 var iter = tmp_dir.iterable_dir.iterate();
371 var iter = tmp_dir.dir.iterate();
374372 while (try iter.next()) |entry| {
375373 // We cannot just store `entry` as on Windows, we're re-using the name buffer
376374 // which means we'll actually share the `name` pointer between entries!
......@@ -423,17 +421,17 @@ test "Dir.Iterator reset" {
423421 defer tmp_dir.cleanup();
424422
425423 // First, create a couple of entries to iterate over.
426 const file = try tmp_dir.iterable_dir.dir.createFile("some_file", .{});
424 const file = try tmp_dir.dir.createFile("some_file", .{});
427425 file.close();
428426
429 try tmp_dir.iterable_dir.dir.makeDir("some_dir");
427 try tmp_dir.dir.makeDir("some_dir");
430428
431429 var arena = ArenaAllocator.init(testing.allocator);
432430 defer arena.deinit();
433431 const allocator = arena.allocator();
434432
435433 // Create iterator.
436 var iter = tmp_dir.iterable_dir.iterate();
434 var iter = tmp_dir.dir.iterate();
437435
438436 var i: u8 = 0;
439437 while (i < 2) : (i += 1) {
......@@ -459,10 +457,10 @@ test "Dir.Iterator but dir is deleted during iteration" {
459457 defer tmp.cleanup();
460458
461459 // Create directory and setup an iterator for it
462 var iterable_subdir = try tmp.dir.makeOpenPathIterable("subdir", .{});
463 defer iterable_subdir.close();
460 var subdir = try tmp.dir.makeOpenPath("subdir", .{ .iterate = true });
461 defer subdir.close();
464462
465 var iterator = iterable_subdir.iterate();
463 var iterator = subdir.iterate();
466464
467465 // Create something to iterate over within the subdir
468466 try tmp.dir.makePath("subdir/b");
......@@ -964,7 +962,7 @@ test "makePath in a directory that no longer exists" {
964962fn testFilenameLimits(iterable_dir: Dir, maxed_filename: []const u8) !void {
965963 // setup, create a dir and a nested file both with maxed filenames, and walk the dir
966964 {
967 var maxed_dir = try iterable_dir.dir.makeOpenPath(maxed_filename, .{});
965 var maxed_dir = try iterable_dir.makeOpenPath(maxed_filename, .{});
968966 defer maxed_dir.close();
969967
970968 try maxed_dir.writeFile(maxed_filename, "");
......@@ -981,7 +979,7 @@ fn testFilenameLimits(iterable_dir: Dir, maxed_filename: []const u8) !void {
981979 }
982980
983981 // ensure that we can delete the tree
984 try iterable_dir.dir.deleteTree(maxed_filename);
982 try iterable_dir.deleteTree(maxed_filename);
985983}
986984
987985test "max file name component lengths" {
......@@ -992,16 +990,16 @@ test "max file name component lengths" {
992990 // U+FFFF is the character with the largest code point that is encoded as a single
993991 // UTF-16 code unit, so Windows allows for NAME_MAX of them.
994992 const maxed_windows_filename = ("\u{FFFF}".*) ** std.os.windows.NAME_MAX;
995 try testFilenameLimits(tmp.iterable_dir, &maxed_windows_filename);
993 try testFilenameLimits(tmp.dir, &maxed_windows_filename);
996994 } else if (builtin.os.tag == .wasi) {
997995 // On WASI, the maxed filename depends on the host OS, so in order for this test to
998996 // work on any host, we need to use a length that will work for all platforms
999997 // (i.e. the minimum MAX_NAME_BYTES of all supported platforms).
1000998 const maxed_wasi_filename = [_]u8{'1'} ** 255;
1001 try testFilenameLimits(tmp.iterable_dir, &maxed_wasi_filename);
999 try testFilenameLimits(tmp.dir, &maxed_wasi_filename);
10021000 } else {
10031001 const maxed_ascii_filename = [_]u8{'1'} ** std.fs.MAX_NAME_BYTES;
1004 try testFilenameLimits(tmp.iterable_dir, &maxed_ascii_filename);
1002 try testFilenameLimits(tmp.dir, &maxed_ascii_filename);
10051003 }
10061004}
10071005
......@@ -1438,14 +1436,14 @@ test "walker without fully iterating" {
14381436 var tmp = tmpDir(.{ .iterate = true });
14391437 defer tmp.cleanup();
14401438
1441 var walker = try tmp.iterable_dir.walk(testing.allocator);
1439 var walker = try tmp.dir.walk(testing.allocator);
14421440 defer walker.deinit();
14431441
14441442 // Create 2 directories inside the tmp directory, but then only iterate once before breaking.
14451443 // This ensures that walker doesn't try to close the initial directory when not fully iterating.
14461444
1447 try tmp.iterable_dir.dir.makePath("a");
1448 try tmp.iterable_dir.dir.makePath("b");
1445 try tmp.dir.makePath("a");
1446 try tmp.dir.makePath("b");
14491447
14501448 var num_walked: usize = 0;
14511449 while (try walker.next()) |_| {
src/Package/Fetch.zig+14-12
......@@ -280,7 +280,7 @@ pub fn run(f: *Fetch) RunError!void {
280280 },
281281 .remote => |remote| remote,
282282 .path_or_url => |path_or_url| {
283 if (fs.cwd().openIterableDir(path_or_url, .{})) |dir| {
283 if (fs.cwd().openDir(path_or_url, .{ .iterate = true })) |dir| {
284284 var resource: Resource = .{ .dir = dir };
285285 return runResource(f, path_or_url, &resource, null);
286286 } else |dir_err| {
......@@ -363,7 +363,9 @@ fn runResource(
363363 var tmp_directory: Cache.Directory = .{
364364 .path = tmp_directory_path,
365365 .handle = handle: {
366 const dir = cache_root.handle.makeOpenPathIterable(tmp_dir_sub_path, .{}) catch |err| {
366 const dir = cache_root.handle.makeOpenPath(tmp_dir_sub_path, .{
367 .iterate = true,
368 }) catch |err| {
367369 try eb.addRootErrorMessage(.{
368370 .msg = try eb.printString("unable to create temporary directory '{s}': {s}", .{
369371 tmp_directory_path, @errorName(err),
......@@ -371,7 +373,7 @@ fn runResource(
371373 });
372374 return error.FetchFailed;
373375 };
374 break :handle dir.dir;
376 break :handle dir;
375377 },
376378 };
377379 defer tmp_directory.handle.close();
......@@ -400,9 +402,9 @@ fn runResource(
400402 if (builtin.os.tag == .linux and f.job_queue.work_around_btrfs_bug) {
401403 // https://github.com/ziglang/zig/issues/17095
402404 tmp_directory.handle.close();
403 const iterable_dir = cache_root.handle.makeOpenPathIterable(tmp_dir_sub_path, .{}) catch
404 @panic("btrfs workaround failed");
405 tmp_directory.handle = iterable_dir.dir;
405 tmp_directory.handle = cache_root.handle.makeOpenPath(tmp_dir_sub_path, .{
406 .iterate = true,
407 }) catch @panic("btrfs workaround failed");
406408 }
407409
408410 f.actual_hash = try computeHash(f, tmp_directory, filter);
......@@ -717,7 +719,7 @@ const Resource = union(enum) {
717719 file: fs.File,
718720 http_request: std.http.Client.Request,
719721 git: Git,
720 dir: fs.IterableDir,
722 dir: fs.Dir,
721723
722724 const Git = struct {
723725 fetch_stream: git.Session.FetchStream,
......@@ -1198,7 +1200,7 @@ fn unpackGitPack(f: *Fetch, out_dir: fs.Dir, resource: *Resource) anyerror!void
11981200 try out_dir.deleteTree(".git");
11991201}
12001202
1201fn recursiveDirectoryCopy(f: *Fetch, dir: fs.IterableDir, tmp_dir: fs.Dir) anyerror!void {
1203fn recursiveDirectoryCopy(f: *Fetch, dir: fs.Dir, tmp_dir: fs.Dir) anyerror!void {
12021204 const gpa = f.arena.child_allocator;
12031205 // Recursive directory copy.
12041206 var it = try dir.walk(gpa);
......@@ -1207,7 +1209,7 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: fs.IterableDir, tmp_dir: fs.Dir) anyer
12071209 switch (entry.kind) {
12081210 .directory => {}, // omit empty directories
12091211 .file => {
1210 dir.dir.copyFile(
1212 dir.copyFile(
12111213 entry.path,
12121214 tmp_dir,
12131215 entry.path,
......@@ -1215,14 +1217,14 @@ fn recursiveDirectoryCopy(f: *Fetch, dir: fs.IterableDir, tmp_dir: fs.Dir) anyer
12151217 ) catch |err| switch (err) {
12161218 error.FileNotFound => {
12171219 if (fs.path.dirname(entry.path)) |dirname| try tmp_dir.makePath(dirname);
1218 try dir.dir.copyFile(entry.path, tmp_dir, entry.path, .{});
1220 try dir.copyFile(entry.path, tmp_dir, entry.path, .{});
12191221 },
12201222 else => |e| return e,
12211223 };
12221224 },
12231225 .sym_link => {
12241226 var buf: [fs.MAX_PATH_BYTES]u8 = undefined;
1225 const link_name = try dir.dir.readLink(entry.path, &buf);
1227 const link_name = try dir.readLink(entry.path, &buf);
12261228 // TODO: if this would create a symlink to outside
12271229 // the destination directory, fail with an error instead.
12281230 tmp_dir.symLink(link_name, entry.path, .{}) catch |err| switch (err) {
......@@ -1296,7 +1298,7 @@ fn computeHash(
12961298 var sus_dirs: std.StringArrayHashMapUnmanaged(void) = .{};
12971299 defer sus_dirs.deinit(gpa);
12981300
1299 var walker = try @as(fs.IterableDir, .{ .dir = tmp_directory.handle }).walk(gpa);
1301 var walker = try tmp_directory.handle.walk(gpa);
13001302 defer walker.deinit();
13011303
13021304 {
src/Package/Fetch/git.zig+4-4
......@@ -1384,11 +1384,11 @@ test "packfile indexing and checkout" {
13841384 var repository = try Repository.init(testing.allocator, pack_file, index_file);
13851385 defer repository.deinit();
13861386
1387 var worktree = testing.tmpIterableDir(.{});
1387 var worktree = testing.tmpDir(.{ .iterate = true });
13881388 defer worktree.cleanup();
13891389
13901390 const commit_id = try parseOid("dd582c0720819ab7130b103635bd7271b9fd4feb");
1391 try repository.checkout(worktree.iterable_dir.dir, commit_id);
1391 try repository.checkout(worktree.dir, commit_id);
13921392
13931393 const expected_files: []const []const u8 = &.{
13941394 "dir/file",
......@@ -1410,7 +1410,7 @@ test "packfile indexing and checkout" {
14101410 var actual_files: std.ArrayListUnmanaged([]u8) = .{};
14111411 defer actual_files.deinit(testing.allocator);
14121412 defer for (actual_files.items) |file| testing.allocator.free(file);
1413 var walker = try worktree.iterable_dir.walk(testing.allocator);
1413 var walker = try worktree.dir.walk(testing.allocator);
14141414 defer walker.deinit();
14151415 while (try walker.next()) |entry| {
14161416 if (entry.kind != .file) continue;
......@@ -1442,7 +1442,7 @@ test "packfile indexing and checkout" {
14421442 \\revision 19
14431443 \\
14441444 ;
1445 const actual_file_contents = try worktree.iterable_dir.dir.readFileAlloc(testing.allocator, "file", max_file_size);
1445 const actual_file_contents = try worktree.dir.readFileAlloc(testing.allocator, "file", max_file_size);
14461446 defer testing.allocator.free(actual_file_contents);
14471447 try testing.expectEqualStrings(expected_file_contents, actual_file_contents);
14481448}
src/windows_sdk.zig+11-3
......@@ -14,7 +14,11 @@ const product_version_max_length = version_major_minor_max_length + ".65535".len
1414/// Iterates via `iterator` and collects all folders with names starting with `optional_prefix`
1515/// and similar to SemVer. Returns slice of folder names sorted in descending order.
1616/// Caller owns result.
17fn iterateAndFilterBySemVer(iterator: *std.fs.IterableDir.Iterator, allocator: std.mem.Allocator, comptime optional_prefix: ?[]const u8) error{ OutOfMemory, VersionNotFound }![][]const u8 {
17fn iterateAndFilterBySemVer(
18 iterator: *std.fs.Dir.Iterator,
19 allocator: std.mem.Allocator,
20 comptime optional_prefix: ?[]const u8,
21) error{ OutOfMemory, VersionNotFound }![][]const u8 {
1822 var dirs_filtered_list = std.ArrayList([]const u8).init(allocator);
1923 errdefer {
2024 for (dirs_filtered_list.items) |filtered_dir| allocator.free(filtered_dir);
......@@ -476,7 +480,9 @@ pub const Windows81Sdk = struct {
476480 if (!std.fs.path.isAbsolute(sdk_lib_dir_path)) return error.Windows81SdkNotFound;
477481
478482 // enumerate files in sdk path looking for latest version
479 var sdk_lib_dir = std.fs.openIterableDirAbsolute(sdk_lib_dir_path, .{}) catch |err| switch (err) {
483 var sdk_lib_dir = std.fs.openDirAbsolute(sdk_lib_dir_path, .{
484 .iterate = true,
485 }) catch |err| switch (err) {
480486 error.NameTooLong => return error.PathTooLong,
481487 else => return error.Windows81SdkNotFound,
482488 };
......@@ -727,7 +733,9 @@ const MsvcLibDir = struct {
727733 if (!std.fs.path.isAbsolute(visualstudio_folder_path)) return error.PathNotFound;
728734 // enumerate folders that contain `privateregistry.bin`, looking for all versions
729735 // f.i. %localappdata%\Microsoft\VisualStudio\17.0_9e9cbb98\
730 var visualstudio_folder = std.fs.openIterableDirAbsolute(visualstudio_folder_path, .{}) catch return error.PathNotFound;
736 var visualstudio_folder = std.fs.openDirAbsolute(visualstudio_folder_path, .{
737 .iterate = true,
738 }) catch return error.PathNotFound;
731739 defer visualstudio_folder.close();
732740
733741 var iterator = visualstudio_folder.iterate();
test/src/Cases.zig+5-5
......@@ -368,7 +368,7 @@ pub fn addCompile(
368368/// Each file should include a test manifest as a contiguous block of comments at
369369/// the end of the file. The first line should be the test type, followed by a set of
370370/// key-value config values, followed by a blank line, then the expected output.
371pub fn addFromDir(ctx: *Cases, dir: std.fs.IterableDir) void {
371pub fn addFromDir(ctx: *Cases, dir: std.fs.Dir) void {
372372 var current_file: []const u8 = "none";
373373 ctx.addFromDirInner(dir, &current_file) catch |err| {
374374 std.debug.panicExtra(
......@@ -382,7 +382,7 @@ pub fn addFromDir(ctx: *Cases, dir: std.fs.IterableDir) void {
382382
383383fn addFromDirInner(
384384 ctx: *Cases,
385 iterable_dir: std.fs.IterableDir,
385 iterable_dir: std.fs.Dir,
386386 /// This is kept up to date with the currently being processed file so
387387 /// that if any errors occur the caller knows it happened during this file.
388388 current_file: *[]const u8,
......@@ -416,7 +416,7 @@ fn addFromDirInner(
416416 }
417417
418418 const max_file_size = 10 * 1024 * 1024;
419 const src = try iterable_dir.dir.readFileAllocOptions(ctx.arena, filename, max_file_size, null, 1, 0);
419 const src = try iterable_dir.readFileAllocOptions(ctx.arena, filename, max_file_size, null, 1, 0);
420420
421421 // Parse the manifest
422422 var manifest = try TestManifest.parse(ctx.arena, src);
......@@ -1246,7 +1246,7 @@ pub fn main() !void {
12461246 var filenames = std.ArrayList([]const u8).init(arena);
12471247
12481248 const case_dirname = std.fs.path.dirname(case_file_path).?;
1249 var iterable_dir = try std.fs.cwd().openIterableDir(case_dirname, .{});
1249 var iterable_dir = try std.fs.cwd().openDir(case_dirname, .{ .iterate = true });
12501250 defer iterable_dir.close();
12511251
12521252 if (std.mem.endsWith(u8, case_file_path, ".0.zig")) {
......@@ -1280,7 +1280,7 @@ pub fn main() !void {
12801280
12811281 for (batch) |filename| {
12821282 const max_file_size = 10 * 1024 * 1024;
1283 const src = try iterable_dir.dir.readFileAllocOptions(arena, filename, max_file_size, null, 1, 0);
1283 const src = try iterable_dir.readFileAllocOptions(arena, filename, max_file_size, null, 1, 0);
12841284
12851285 // Parse the manifest
12861286 var manifest = try TestManifest.parse(arena, src);
test/tests.zig+1-1
......@@ -1288,7 +1288,7 @@ pub fn addCases(
12881288
12891289 var cases = @import("src/Cases.zig").init(gpa, arena);
12901290
1291 var dir = try b.build_root.handle.openIterableDir("test/cases", .{});
1291 var dir = try b.build_root.handle.openDir("test/cases", .{ .iterate = true });
12921292 defer dir.close();
12931293
12941294 cases.addFromDir(dir);
tools/generate_JSONTestSuite.zig+1-1
......@@ -18,7 +18,7 @@ pub fn main() !void {
1818 );
1919
2020 var names = std.ArrayList([]const u8).init(allocator);
21 var cwd = try std.fs.cwd().openIterableDir(".", .{});
21 var cwd = try std.fs.cwd().openDir(".", .{ .iterate = true });
2222 var it = cwd.iterate();
2323 while (try it.next()) |entry| {
2424 try names.append(try allocator.dupe(u8, entry.name));