I have this simple test case. I noticed my program giving me an Unexpected error when trying to call .next() on a walker, so decided ot investigate. For some reason I can’t get my test program to do this, but it does panic. From my reading of the docs, it’s specified that iterate = true is needed for iterate, but not walk. it makes sense, buty I didn’t think of it.
const std = @import("std");
pub fn main(init: std.process.Init) !void {
const allocator = init.gpa;
const io = init.io;
std.debug.print("Testing with iterate = true…\n", .{});
var dir1 = try std.Io.Dir.cwd().openDir(io, ".", .{ .iterate = true });
defer dir1.close(io);
var w1 = try dir1.walk(allocator);
defer w1.deinit();
_ = try w1.next(io);
std.debug.print("Success. Testing with iterate = false…\n", .{});
var dir2 = try std.Io.Dir.cwd().openDir(io, ".", .{ .iterate = false });
defer dir2.close(io);
var w2 = try dir2.walk(allocator);
defer w2.deinit();
_ = try w2.next(io);
std.debug.print("No errors.\n", .{});
}