links and some path checks

This commit is contained in:
Tyrel Souza 2023-07-03 00:43:41 -04:00
parent 177c23da42
commit a3cf2380b7
No known key found for this signature in database
GPG Key ID: F3614B02ACBE438E
2 changed files with 6 additions and 3 deletions

View File

@ -107,4 +107,4 @@ links:
links: links:
- text: Fork this project! - text: Fork this project!
icon: fa-solid fa-code-fork icon: fa-solid fa-code-fork
href: https://github.com/tyrelsouza/lazylinks href: https://gitea.tyrel.dev/tyrel/rustylinks

View File

@ -55,7 +55,10 @@ fn write_file(html: String ) {
fs::remove_dir_all("./output").expect("could not remove directory"); fs::remove_dir_all("./output").expect("could not remove directory");
} }
fs::create_dir("./output").expect("Could not create output directory"); fs::create_dir("./output").expect("Could not create output directory");
// copy all files in static to output
if Path::new("./output").exists() {
copy_recursively("./static", "./output").expect("Could not copy static directory"); copy_recursively("./static", "./output").expect("Could not copy static directory");
}
fs::write("./output/index.html", html).expect("Could not write to index.html"); fs::write("./output/index.html", html).expect("Could not write to index.html");
} }