Pi66

merodi
A markdown-based static site generator.
git clone https://git.pi66.xyz/merodi

← back to log

fix: resolve output paths and force file builds

author: pi66
date: 2026-07-22 15:26
hash: 6398a37a2e84eba35d481d75c5a5e233511d07e5

Diffstat:

M

src/build.py
7 ++++++++++++++++++++++++++----
 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
diff --git a/src/build.py b/src/build.py
index dac49a1..a3b511e 100644
--- a/src/build.py
+++ b/src/build.py
@@ -94,6 +94,7 @@ def jinja_handler(config, html_content, plugins=None):

 @expose("save_html")
 def save_html(html_content, html_dest):
+    html_dest = path.abspath(html_dest)
     makedirs(path.dirname(html_dest), exist_ok=True)
     write_file(html_dest, html_content)
     hook_call("on_page_written", html_dest, html_content)
@@ -196,7 +197,11 @@ def build_if_file(project_path, file):
         raise ValueError("Specify either a project path or a file path, not both.")
     if len(file) != 2:
         raise ValueError("A file path must include exactly a source and a destination.")
-    compile_file(file[0], file[1])
+    html_dest = path.abspath(file[1])
+    if path.isdir(html_dest):
+        html_dest = path.join(html_dest,"index.html")
+
+    compile_file(file[0], html_dest, force=True)

 def build(mode, project_path, file, validate=False, force=False):
     try: