@@ -67,27 +67,22 @@ pub fn build(b: *std.Build) void {
6767 const cache_include = std .fs .path .join (b .allocator , &.{ b .sysroot .? , "cache" , "sysroot" , "include" }) catch @panic ("Out of memory" );
6868 defer b .allocator .free (cache_include );
6969
70+ // TODO: Remove compatibility shim when minimum Zig version is 0.16.0.
7071 if (@hasDecl (std .Io , "Dir" )) {
71- // v0 .16 -> Dir moved to std.Io
72- const open_dir_opts : std.Io.Dir.OpenOptions = .{
72+ // Zig 0 .16.0-dev
73+ var dir = std .Io .Dir .openDirAbsolute ( mod . owner . graph . io , cache_include , .{
7374 .access_sub_paths = true ,
7475 .follow_symlinks = false ,
75- };
76-
77- var dir = std .Io .Dir .openDirAbsolute (mod .owner .graph .io , cache_include , open_dir_opts ) catch @panic ("No emscripten cache. Generate it!" );
78-
76+ }) catch @panic ("No emscripten cache. Generate it!" );
7977 dir .close (mod .owner .graph .io );
8078 } else if (@hasDecl (std .fs , "Dir" )) {
81- // <= 0.15.2 -> Dir on std.fs
82- const open_dir_opts : std.fs.Dir.OpenOptions = .{
79+ // Zig 0.15.x
80+ var dir = std .fs .openDirAbsolute ( cache_include , .{
8381 .access_sub_paths = true ,
84- .follow_symlinks = false ,
85- };
86-
87- var dir = std .fs .openDirAbsolute (cache_include , open_dir_opts ) catch @panic ("No emscripten cache. Generate it!" );
88-
82+ .no_follow = true ,
83+ }) catch @panic ("No emscripten cache. Generate it!" );
8984 dir .close ();
90- }
85+ } else @compileError ( "Fix `openDirAbsolute` compatibility shim" );
9186
9287 mod .addIncludePath (.{ .cwd_relative = cache_include });
9388 },
0 commit comments