From 607c47157e53d346af9ecb31e8c36c03ab96e431 Mon Sep 17 00:00:00 2001 From: prajwalch Date: Mon, 16 Sep 2024 11:47:59 +0545 Subject: [PATCH] fix(#28): Don't add `examples` step if examples dir is missing Signed-off-by: prajwalch --- build.zig | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index fe8dc49..054d849 100644 --- a/build.zig +++ b/build.zig @@ -18,14 +18,12 @@ fn testStep(b: *std.Build) void { } fn examplesStep(b: *std.Build, yazap: *std.Build.Module) void { - const step = b.step("examples", "Build all the examples"); - - var dir = std.fs.cwd().openDir("./examples/", .{ .iterate = true }) catch @panic( - "failed to open examples dir", - ); + var dir = std.fs.cwd().openDir("./examples/", .{ .iterate = true }) catch return; defer dir.close(); + const step = b.step("examples", "Build all the examples"); var examples = dir.iterate(); + while (examples.next() catch @panic("failed to get example file")) |example_file| { std.debug.assert(example_file.kind == .file);