Io.Dir.readFileAlloc fails after opening directory to iterate over

So, I’m opening a directory to pass to imgui, expecting a string for a filename in return

var dir = try std.Io.Dir.cwd().openDir(io, “src/shaders/”, .{
  .iterate = true,
});
defer dir.close(io);
if (gui.fileMenu(io, dir, “shaders”)) |selected_file| {
  std.debug.print("{s}\n", .{ selected_file });
  const _file = try dir.readFileAlloc(
    io,
    selected_file,
    arena.allocator(),
    .unlimited,
  );

I get a file not found error, even though the file name prints correctly. Dir.cwd() must be getting the right subdirectory for the gui to iterate over files, is there a way to get the subdirectory pointed at by dir to check?

I suspect the details of gui.fileMenu() might be where the answer is hiding, maybe a simpler repro without the gui would reveal something?

Just kidding, I figured it out. At least in my case, opening a file from the Dir and using readStreamingAll worked just fine:

    const _file = try dir.openFile(
        io,
        selected_file,
        .{}
    );
    _ = try _file.readPositionalAll(io, &buf, 0);

I’m not sure why readFileAlloc failed, it seems like the most direct path to reading the file. I’m not sure if I was using it incorrectly, perhaps a bug in std?