Skip to content

Commit 477dc6b

Browse files
authored
Merge pull request #703 from cers000/patch-1
Modify Zig version to 0.17
2 parents f4e43bb + 7d1114e commit 477dc6b

1 file changed

Lines changed: 18 additions & 1 deletion

File tree

build.zig

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,24 @@ fn build_examples(b: *Build, webui: *Compile) !void {
173173
// Iterate examples/C. Zig 0.16 removed std.fs.cwd() and reworked Dir/Iterator
174174
// to require an Io instance, so split the open+iterate path by version while
175175
// sharing the per-example wiring below.
176-
if (comptime builtin.zig_version.minor >= 16) {
176+
if (comptime builtin.zig_version.minor >= 17) {
177+
const io = b.graph.io;
178+
var examples_dir = b.root.root_dir.handle.openDir(
179+
io,
180+
"examples/C",
181+
.{ .iterate = true },
182+
) catch |e| switch (e) {
183+
error.FileNotFound => return,
184+
else => return e,
185+
};
186+
defer examples_dir.close(io);
187+
188+
var paths = examples_dir.iterate();
189+
while (try paths.next(io)) |val| {
190+
if (val.kind != .directory) continue;
191+
try add_example(b, webui, build_examples_step, val.name);
192+
}
193+
} else if (comptime builtin.zig_version.minor >= 16) {
177194
const io = b.graph.io;
178195
var examples_dir = b.build_root.handle.openDir(
179196
io,

0 commit comments

Comments
 (0)