From 7d038df855152c1e3277cf60339b7e742ccedcc5 Mon Sep 17 00:00:00 2001 From: Ankit Patial Date: Mon, 19 Jan 2026 19:01:50 +0530 Subject: [PATCH] Fix panic when mixin not found with relative mixins_dir path The loadMixinFromDir function used openDirAbsolute which requires an absolute path, but ViewEngine passes a relative path for mixins_dir. This caused a panic when a mixin call couldn't find the mixin in the current template. Fix: Check if mixins_dir is absolute and use the appropriate method: - std.fs.openDirAbsolute() for absolute paths - std.fs.cwd().openDir() for relative paths --- src/runtime.zig | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/runtime.zig b/src/runtime.zig index 4df5645..a24df6f 100644 --- a/src/runtime.zig +++ b/src/runtime.zig @@ -867,7 +867,11 @@ pub const Runtime = struct { } // Second try: iterate through all .pug files in mixins directory - var dir = std.fs.openDirAbsolute(self.mixins_dir, .{ .iterate = true }) catch return null; + // Use cwd().openDir for relative paths, openDirAbsolute for absolute paths + var dir = if (std.fs.path.isAbsolute(self.mixins_dir)) + std.fs.openDirAbsolute(self.mixins_dir, .{ .iterate = true }) catch return null + else + std.fs.cwd().openDir(self.mixins_dir, .{ .iterate = true }) catch return null; defer dir.close(); var iter = dir.iterate();