fix: polling check is reversed

This commit is contained in:
CJ van den Berg 2026-03-14 13:59:04 +01:00
parent b1457806d7
commit bb32bcea1e
Signed by: neurocyte
GPG key ID: 8EB1E1BB660E3FB9
2 changed files with 3 additions and 2 deletions

View file

@ -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,

View file

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