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, 12 insertions, 1 deletions
diff --git a/src/file_watch.zig b/src/file_watch.zig
index d028488e..8bd9de8b 100644
--- a/src/file_watch.zig
+++ b/src/file_watch.zig
@@ -70,7 +70,11 @@ pub const Watch = struct {
/// Sharing the table also shares directory descriptors correctly when a user
/// happens to open that .zon as an ordinary document.
pub const theme_slot = pardes.MAX_PANES;
-pub const Table = [pardes.MAX_PANES + 1]?Watch;
+/// After it, one slot a post chain file (shader_build.zig): marked only so
+/// a save there wakes the host, which has the files read again; no
+/// generation of theirs is kept here.
+pub const shader_slot = theme_slot + 1;
+pub const Table = [shader_slot + pardes.config.Runtime.Post.max]?Watch;
/// Whether this OS has a watcher at all. Off it every entry point below
/// returns the inert answer: `watchPath` installs nothing, so `watches` stays
@@ -423,6 +427,13 @@ pub fn watchPane(
watchPath(fd, watches, id, path, serial, generation);
}
+/// Mark the post chain files' directories, one slot each, dropping the
+/// marks of files no longer in it.
+pub fn watchShaders(fd: c_int, watches: *Table, paths: []const []const u8) void {
+ for (0..pardes.config.Runtime.Post.max) |i|
+ watchPath(fd, watches, shader_slot + i, if (i < paths.len) paths[i] else null, 0, .{ .text = 0 });
+}
+
/// Reconcile one marked pane. A true result requests an immediate second pass:
/// the PDF pathname changed between the stat before MuPDF reopened it and the
/// stat after, so committing either identity would lose a generation.