diff --git a/Cargo.lock b/Cargo.lock index 187b0d8..705a892 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -243,7 +243,7 @@ checksum = "4a1a07cc7db3810833284e8d372ccdc6da29741639ecc70c9ec107df0fa6154c" [[package]] name = "webTemplate" -version = "0.4.0" +version = "0.4.1" dependencies = [ "hashlink", "minijinja", diff --git a/Cargo.toml b/Cargo.toml index cc877fc..82c733b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "webTemplate" -version = "0.4.0" +version = "0.4.1" edition = "2024" [dependencies] diff --git a/src/main.rs b/src/main.rs index 1b18d77..0174c30 100644 --- a/src/main.rs +++ b/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,9 +75,16 @@ 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 _ = fs::copy(src, dest_path); + 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 => {