about summary refs log tree commit diff
path: root/src/gen.zig
diff options
context:
space:
mode:
authorRobert Günzler <r@gnzler.io>2025-10-03 19:01:17 +0200
committerRobert Günzler <r@gnzler.io>2025-10-04 18:41:56 +0200
commit17cec3c7f6cb46d8d80c2364eba8296f6dd01ef3 (patch)
treea659d8c6ab37de10f4f2eaa623b3d7cd6b47b288 /src/gen.zig
parentd8ad5e027f60cd8ac86b96eaf4d267e149422025 (diff)
downloadsite-17cec3c7f6cb46d8d80c2364eba8296f6dd01ef3.tar.gz
use canonical duck typing for function names
Signed-off-by: Robert Günzler <r@gnzler.io>
Diffstat (limited to 'src/gen.zig')
-rw-r--r--src/gen.zig26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/gen.zig b/src/gen.zig
index 6d2f124..0504d39 100644
--- a/src/gen.zig
+++ b/src/gen.zig
@@ -22,7 +22,7 @@ fn genIndexHtml(ctx: *Context) !void {
     ctx.progress_start("index.html");
     defer ctx.progress_end();
 
-    const srcpathIndex = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{"index.htm"});
+    const srcpathIndex = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{"index.htm"});
     defer ctx.allocator().free(srcpathIndex);
 
     const f = try fs.FileSwapper.createAt(ctx.allocator(), srcpathIndex);
@@ -48,8 +48,8 @@ fn genIndexHtml(ctx: *Context) !void {
     for (ctx.pages.items) |p| {
         if (std.mem.startsWith(u8, p, "meta.")) continue;
 
-        const dstname = try fs.strip_extension(p);
-        const dstpath = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{ dstname, ".html" });
+        const dstname = try fs.stripExtension(p);
+        const dstpath = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{ dstname, ".html" });
         defer ctx.allocator().free(dstpath);
 
         try f.writer().print(
@@ -79,10 +79,10 @@ fn genSite(ctx: *Context) !void {
             continue;
         }
 
-        const dstname = try fs.strip_extension(p);
-        const srcpath = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{ dstname, ".htm" });
+        const dstname = try fs.stripExtension(p);
+        const srcpath = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{ dstname, ".htm" });
         defer ctx.allocator().free(srcpath);
-        const dstpath = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{ dstname, ".html" });
+        const dstpath = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{ dstname, ".html" });
         defer ctx.allocator().free(dstpath);
         const rel_dstpath = try std.fs.path.relative(ctx.allocator(), Context.params.SITE_PATH, dstpath);
         defer ctx.allocator().free(rel_dstpath);
@@ -90,7 +90,7 @@ fn genSite(ctx: *Context) !void {
         log.debug("generating {s} at {s}", .{ p, rel_dstpath });
 
         if (std.fs.path.dirname(rel_dstpath)) |d| {
-            const dstdir = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{d});
+            const dstdir = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.SITE_PATH}, &.{d});
             defer ctx.allocator().free(dstdir);
 
             try std.fs.cwd().makePath(dstdir);
@@ -109,8 +109,8 @@ fn genSite(ctx: *Context) !void {
 
 // build a single html file
 fn build(allocator: std.mem.Allocator, w: std.io.AnyWriter, page_name: []const u8, srcpath: []const u8) !void {
-    const mtime = try fs.get_mtime(allocator, srcpath);
-    const mtime_str = try fs.format_mtime(allocator, mtime, "%F");
+    const mtime = try fs.getMtime(allocator, srcpath);
+    const mtime_str = try fs.formatMtime(allocator, mtime, "%F");
     defer allocator.free(mtime_str);
 
     // HEAD
@@ -208,9 +208,9 @@ fn meta(ctx: *Context, p: []const u8) !void {
     if (std.mem.startsWith(u8, p, "meta.tilde.")) {
         const dot = std.mem.indexOfPosLinear(u8, p, 11, ".");
         const dstname = p[11..dot.?];
-        const srcpath = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{p});
+        const srcpath = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.PAGE_PATH}, &.{p});
         defer ctx.allocator().free(srcpath);
-        const dstpath = try fs.join_path_and_filename(ctx.allocator(), &.{Context.params.LINK_PATH}, &.{ "~", dstname });
+        const dstpath = try fs.joinPathAndFilename(ctx.allocator(), &.{Context.params.LINK_PATH}, &.{ "~", dstname });
         defer ctx.allocator().free(dstpath);
 
         const link = blk: {
@@ -333,8 +333,8 @@ const Page = struct {
 
         const endofref = std.mem.lastIndexOf(u8, refname, "#") orelse refname.len;
         const basename = try std.mem.replaceOwned(u8, arena.allocator(), refname[0..endofref], " ", "_");
-        const html = try fs.join_path_and_filename(arena.allocator(), &.{Context.params.SITE_PATH}, &.{ basename, ".html" });
-        const htm = try fs.join_path_and_filename(arena.allocator(), &.{Context.params.PAGE_PATH}, &.{ basename, ".htm" });
+        const html = try fs.joinPathAndFilename(arena.allocator(), &.{Context.params.SITE_PATH}, &.{ basename, ".html" });
+        const htm = try fs.joinPathAndFilename(arena.allocator(), &.{Context.params.PAGE_PATH}, &.{ basename, ".htm" });
 
         try std.fs.cwd().access(htm, .{ .mode = .read_only });