summaryrefslogtreecommitdiff
path: root/src/file_watch.zig
diff options
context:
space:
mode:
Diffstat (limited to 'src/file_watch.zig')
-rw-r--r--src/file_watch.zig13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/file_watch.zig b/src/file_watch.zig
index 8bd9de8b..148bc836 100644
--- a/src/file_watch.zig
+++ b/src/file_watch.zig
@@ -397,7 +397,7 @@ fn watchPath(
// stat and a lookup out there: the turn goes out with them.
pardes.turn.yield();
defer pardes.turn.back();
- const stat = std.Io.Dir.cwd().statFile(std.Io.Threaded.global_single_threaded.io(), watched_path, .{}) catch null;
+ const stat = @import("fs.zig").statPath(std.Io.Threaded.global_single_threaded.io(), watched_path, .{}) catch null;
const dir = if (stat != null and stat.?.kind == .directory) watched_path else std.fs.path.dirname(watched_path) orelse ".";
var dir_buf: [4096:0]u8 = undefined;
if (dir.len >= dir_buf.len) return;
@@ -576,12 +576,19 @@ pub fn applyThemeEffect(
watchPath(fd, watches, theme_slot, null, 0, .{ .text = 0 });
if (!on) return false;
const request = colors.themeFileRequest(core, generation) orelse return false;
+ // What fails here is the ThemeFile write's failure too, which waits on
+ // this (the one-failure rule): late, as a Save's.
+ const pane = request.pane;
const bytes = filesystem.readFile(gpa, request.path) catch |err| {
colors.failThemeFile(core, generation, err);
+ core.noteLateFailure(pane);
return false;
};
defer gpa.free(bytes);
- if (!colors.loadThemeFile(core, generation, bytes, animate)) return false;
+ if (!colors.loadThemeFile(core, generation, bytes, animate)) {
+ core.noteLateFailure(pane);
+ return false;
+ }
const hash = std.hash.Wyhash.hash(0, bytes);
watchPath(fd, watches, theme_slot, request.path, generation, .{ .text = hash });
if (watches[theme_slot] == null) return false;
@@ -631,7 +638,7 @@ pub fn identify(io: std.Io, path: []const u8) !Identity {
const native = filesystem.localPath(path) orelse return error.NonLocalPath;
pardes.turn.yield();
defer pardes.turn.back();
- const stat = try std.Io.Dir.cwd().statFile(io, native, .{});
+ const stat = try @import("fs.zig").statPath(io, native, .{});
if (stat.kind != .file) return error.NotFile;
return .{
.inode = stat.inode,