added fmt and defer

This commit is contained in:
Simon Kellet
2026-06-22 23:46:06 +01:00
parent 437fe17db0
commit f96b506abf
3 changed files with 14 additions and 28 deletions
+9 -9
View File
@@ -34,7 +34,6 @@ main :: proc() {
md_files := walk_tree_and_get_md_names(directory, arena_alloc)
for file, i in md_files {
os.change_directory(directory)
//fmt.printfln("INFO: Parsing %s from .MD to HTML...", file)
html, parse_err := parse_file_md_to_html(file, arena_alloc)
if parse_err != nil {
@@ -42,11 +41,11 @@ main :: proc() {
}
filename := strings.split(file, directory, arena_alloc)
//fmt.printfln("INFO: filename: %s", filename)
trimmed_filename := strings.trim_right(filename[1], ".md")
//fmt.printfln("INFO: trimmed_filename: %s", trimmed_filename)
//Change to output directory...
//Change to output directory. Not sure if this is needed
//But messing around with it means I create a lot of
//files to clean up. Works for now!
os.change_directory(output_dir)
//print html file name
@@ -63,10 +62,11 @@ main :: proc() {
write_prefixs_to_html_file(file)
os.write_string(file, html) //WRITE PAGE
switch trimmed_filename {
case "index":
defer {
//Defer this as we want the last page written to have
//accurate timings
defer {
switch trimmed_filename {
case "index":
buf: [1024]u8
date := time.now()
end := time.tick_since(start)
@@ -84,5 +84,5 @@ main :: proc() {
}
}
}
free_all(arena_alloc)
}