From a76c1f490954bb1290ef99b00da4fcfc17db1e12 Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Thu, 22 May 2025 11:54:24 +0200 Subject: [PATCH] fix: workaround broken dir.statFile on WSL1 Zig standard library does not work with WSL1's semi-broken stat syscall support. To avoid flow being completely unusable on WSL1 we just fall back to a zero mtime if stat fails. This destroys MRU ordering in the file finder on WSL1, but at least it works. --- src/walk_tree.zig | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/walk_tree.zig b/src/walk_tree.zig index bae5a68..5b9a264 100644 --- a/src/walk_tree.zig +++ b/src/walk_tree.zig @@ -63,7 +63,10 @@ pub fn start(a_: std.mem.Allocator, root_path_: []const u8) (SpawnError || std.f fn next(self: *tree_walker) !void { if (try self.walker.next()) |path| { - const stat = self.dir.statFile(path) catch return tp.self_pid().send(.{"next"}); + const stat = self.dir.statFile(path) catch { + try self.parent.send(.{ "walk_tree_entry", self.root_path, path, 0, 0 }); + return tp.self_pid().send(.{"next"}); + }; const mtime = stat.mtime; const high: i64 = @intCast(mtime >> 64); const low: i64 = @truncate(mtime);