links and some path checks
This commit is contained in:
parent
177c23da42
commit
a3cf2380b7
@ -107,4 +107,4 @@ links:
|
||||
links:
|
||||
- text: Fork this project!
|
||||
icon: fa-solid fa-code-fork
|
||||
href: https://github.com/tyrelsouza/lazylinks
|
||||
href: https://gitea.tyrel.dev/tyrel/rustylinks
|
||||
|
@ -50,12 +50,15 @@ fn render_links(rusty_links: RustyLinks) -> String {
|
||||
tera.render("main.tera", &context).expect("Could not parse")
|
||||
}
|
||||
|
||||
fn write_file(html: String ) {
|
||||
fn write_file(html: String) {
|
||||
if Path::new("./output").exists() {
|
||||
fs::remove_dir_all("./output").expect("could not remove 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");
|
||||
}
|
||||
fs::write("./output/index.html", html).expect("Could not write to index.html");
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user