add more error logging
This commit is contained in:
2
Cargo.lock
generated
2
Cargo.lock
generated
@@ -243,7 +243,7 @@ checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c"
|
||||
|
||||
[[package]]
|
||||
name = "webTemplate"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
dependencies = [
|
||||
"hashlink",
|
||||
"minijinja",
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "webTemplate"
|
||||
version = "0.4.0"
|
||||
version = "0.4.1"
|
||||
edition = "2024"
|
||||
|
||||
[dependencies]
|
||||
|
||||
18
src/main.rs
18
src/main.rs
@@ -60,7 +60,12 @@ fn render_index(
|
||||
};
|
||||
let dest_path: &Path = &cur_path.join(format!("{}.{}", friendly, extention));
|
||||
// render the content
|
||||
println!("INFO: render {}", dest_path.to_str().unwrap());
|
||||
let dest_path_str = dest_path.to_str();
|
||||
if dest_path_str == None {
|
||||
println!("ERROR: dest path is None for page: {}", friendly);
|
||||
return;
|
||||
}
|
||||
println!("INFO: render {}", dest_path_str.unwrap());
|
||||
match site_index.render_page(index, &site_index.site, jinja_env) {
|
||||
Some(content) => {
|
||||
let _ = fs::write(dest_path, content);
|
||||
@@ -70,10 +75,17 @@ fn render_index(
|
||||
}
|
||||
else {
|
||||
// file is an asset, no rendering done for assets
|
||||
let dest_path: &Path = &cur_path.join(friendly);
|
||||
println!("INFO: copy {}", dest_path.to_str().unwrap());
|
||||
let dest_path: &Path = &cur_path.join(friendly.clone());
|
||||
match dest_path.to_str() {
|
||||
Some(dest_path_str) => {
|
||||
println!("INFO: copy {}", dest_path_str);
|
||||
let _ = fs::copy(src, dest_path);
|
||||
}
|
||||
None => {
|
||||
println!("ERROR: dest path is None for asset: {}", friendly);
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
None => {
|
||||
let _ = fs::create_dir(dest_path);
|
||||
|
||||
Reference in New Issue
Block a user