Commit 24633b5613

Kirk Scheibelhut <kjs@scheibo.com>
2022-05-12 21:05:07
zig fmt: make --exclude ignore missing dirs
1 parent fb06923
Changed files (1)
src/main.zig
@@ -3960,7 +3960,10 @@ pub fn cmdFmt(gpa: Allocator, arena: Allocator, args: []const []const u8) !void
     // Mark any excluded files/directories as already seen,
     // so that they are skipped later during actual processing
     for (excluded_files.items) |file_path| {
-        var dir = try fs.cwd().openDir(file_path, .{});
+        var dir = fs.cwd().openDir(file_path, .{}) catch |err| switch (err) {
+            error.FileNotFound => continue,
+            else => |e| return e,
+        };
         defer dir.close();
 
         const stat = try dir.stat();