site

A custom static site generator written in C.
git clone https://unitehenry.com/git/site.git
Log | Files | Refs | README

commit 7f515f39fe04587a09552d311700dfcffd68e20a
parent e6ef5d8b2be7958894e47fc61e48842c1779bab3
Author: Henry Unite <unitehenry@gmail.com>
Date:   Thu,  9 Apr 2026 04:32:16 +0000

feat: from and to dir

Diffstat:
Msrc/main.c | 12+++++++++---
1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/src/main.c b/src/main.c @@ -7,6 +7,8 @@ #include <stdlib.h> #include <string.h> +char *BUILD_DIRECTORY = "build"; + /* * - For each markdown file in `content` (command line arg) * - Generate html with `pandoc` @@ -71,11 +73,15 @@ void to_write_path(char **write_path, char *read_path) { path_root(&root, *write_path); - char root_t[strlen(root) + strlen("/")]; + char from_dir[strlen(root) + 2]; + + snprintf(from_dir, strlen(root) + 2, "%s/", root); + + char to_dir[strlen(BUILD_DIRECTORY) + 2]; - snprintf(root_t, strlen(root) + 2, "%s/", root); + snprintf(to_dir, strlen(BUILD_DIRECTORY) + 2, "%s/", BUILD_DIRECTORY); - *write_path = str_replace(*write_path, root_t, "build/"); + *write_path = str_replace(*write_path, from_dir, to_dir); } void generate_pages(StringList *list) {