fix(wsl): use zero mtime if statFile fails
This commit is contained in:
parent
983c4844ba
commit
f71e4c7b04
1 changed files with 4 additions and 2 deletions
|
@ -2064,14 +2064,16 @@ pub fn process_git(self: *Self, parent: tp.pid_ref, m: tp.message) (OutOfMemoryE
|
||||||
try self.loaded(parent);
|
try self.loaded(parent);
|
||||||
} else if (try m.match(.{ tp.any, tp.any, "workspace_files", tp.extract(&path) })) {
|
} else if (try m.match(.{ tp.any, tp.any, "workspace_files", tp.extract(&path) })) {
|
||||||
self.longest_file_path = @max(self.longest_file_path, path.len);
|
self.longest_file_path = @max(self.longest_file_path, path.len);
|
||||||
const stat = std.fs.cwd().statFile(path) catch return;
|
const mtime: i128 = blk: {
|
||||||
|
break :blk (std.fs.cwd().statFile(path) catch break :blk 0).mtime;
|
||||||
|
};
|
||||||
const file_type: []const u8, const file_icon: []const u8, const file_color: u24 = guess_file_type(path);
|
const file_type: []const u8, const file_icon: []const u8, const file_color: u24 = guess_file_type(path);
|
||||||
(try self.pending.addOne(self.allocator)).* = .{
|
(try self.pending.addOne(self.allocator)).* = .{
|
||||||
.path = try self.allocator.dupe(u8, path),
|
.path = try self.allocator.dupe(u8, path),
|
||||||
.type = file_type,
|
.type = file_type,
|
||||||
.icon = file_icon,
|
.icon = file_icon,
|
||||||
.color = file_color,
|
.color = file_color,
|
||||||
.mtime = stat.mtime,
|
.mtime = mtime,
|
||||||
};
|
};
|
||||||
} else if (try m.match(.{ tp.any, tp.any, "workspace_files", tp.null_ })) {
|
} else if (try m.match(.{ tp.any, tp.any, "workspace_files", tp.null_ })) {
|
||||||
self.state.workspace_files = .done;
|
self.state.workspace_files = .done;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue