diff options
Diffstat (limited to 'src/main.zig')
| -rw-r--r-- | src/main.zig | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/main.zig b/src/main.zig index e3bfb44..61ab139 100644 --- a/src/main.zig +++ b/src/main.zig @@ -414,11 +414,12 @@ fn genIndexHtml(ctx: *Context) !void { } fn index(allocator: std.mem.Allocator, rootpath: []const u8) ![][]const u8 { - var root = std.fs.cwd().openDir(rootpath, .{ .iterate = true }) catch |err| { - if (err == error.FileNotFound) { + var root = std.fs.cwd().openDir(rootpath, .{ .iterate = true }) catch |err| switch (err) { + error.FileNotFound => { std.log.err("Missing {s} folder.", .{PAGE_PATH}); std.os.linux.exit(1); - } else return err; + }, + else => |e| return e, }; defer root.close(); |