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.
This commit is contained in:
CJ van den Berg 2025-05-22 11:54:24 +02:00
parent 2412dd36e6
commit a76c1f4909
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9

View file

@ -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);