From bb32bcea1eeb983348cd0e267e05ec899ab6ed8c Mon Sep 17 00:00:00 2001 From: CJ van den Berg Date: Sat, 14 Mar 2026 13:59:04 +0100 Subject: [PATCH] fix: polling check is reversed --- src/backend/INotify.zig | 1 + src/nightwatch.zig | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/backend/INotify.zig b/src/backend/INotify.zig index 365f773..d16027d 100644 --- a/src/backend/INotify.zig +++ b/src/backend/INotify.zig @@ -27,6 +27,7 @@ pub fn Create(comptime variant: InterfaceType) type { pub const watches_recursively = false; pub const detects_file_modifications = true; + pub const polling = variant == .polling; const Handler = switch (variant) { .threaded => types.Handler, diff --git a/src/nightwatch.zig b/src/nightwatch.zig index eccc0f6..499caf6 100644 --- a/src/nightwatch.zig +++ b/src/nightwatch.zig @@ -187,7 +187,7 @@ pub fn Create(comptime variant: Variant) type { /// Only available for the `.polling` variant (Linux inotify). Call this /// whenever `poll_fd()` is readable. pub fn handle_read_ready(self: *@This()) !void { - comptime if (@hasDecl(Backend, "polling") and Backend.polling) @compileError("handle_read_ready is only available in polling backends"); + comptime if (!(@hasDecl(Backend, "polling") and Backend.polling)) @compileError("handle_read_ready is only available in polling backends"); try self.interceptor.backend.handle_read_ready(self.allocator); } @@ -196,7 +196,7 @@ pub fn Create(comptime variant: Variant) type { /// /// Only available for the `.polling` variant (Linux inotify). pub fn poll_fd(self: *const @This()) std.posix.fd_t { - comptime if (@hasDecl(Backend, "polling") and Backend.polling) @compileError("poll_fd is only available in polling backends"); + comptime if (!(@hasDecl(Backend, "polling") and Backend.polling)) @compileError("poll_fd is only available in polling backends"); return self.interceptor.backend.inotify_fd; }