about summary refs log tree commit diff
path: root/src/gen.zig
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/gen.zig13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/gen.zig b/src/gen.zig
index 4b9735d..2a01590 100644
--- a/src/gen.zig
+++ b/src/gen.zig
@@ -6,6 +6,9 @@ const fs = @import("fs.zig");
 const exe = @import("exe.zig");
 
 pub fn fixMtimes(ctx: *Context) !void {
+    var buf: [2 * std.os.linux.PATH_MAX]u8 = undefined;
+    var fba = std.heap.FixedBufferAllocator.init(&buf);
+
     ctx.progress_start("Fix mtimes");
     defer ctx.progress_end();
 
@@ -14,13 +17,11 @@ pub fn fixMtimes(ctx: *Context) !void {
         ctx.progress_start(p);
         defer ctx.progress_end();
 
-        const path = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{p});
-        defer ctx.allocator().free(path);
-
-        const mdpath = try fs.replaceExtension(ctx.allocator(), p, "md");
-        defer ctx.allocator().free(mdpath);
+        const path = try fs.joinPathAndFilename(fba.allocator(), &.{Context.params.PAGE_PATH}, &.{p});
+        const mdpath = try fs.replaceExtension(fba.allocator(), path, "md");
+        defer fba.reset();
 
-        std.fs.cwd().access(mdpath, .{ .mode = .read_only }) catch {
+        std.fs.cwd().access(mdpath, .{}) catch {
             // only set mtime from git if no markdown source is used
             const ts = fs.getGitTime(path) catch continue;
             try fs.setMtime(path, ts);