Skip to content

Commit

Permalink
fix: don't change extension for copied files
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Brue <[email protected]>
  • Loading branch information
ryanabx committed Dec 19, 2024
1 parent 06160fb commit 55c82d3
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,9 @@ fn generate(root_dir: &Path, output_dir: &Path, web_prefix: Option<&str>) -> any
}
}
} else if x_path.is_file() {
let result_path =
output_dir.join(x_path.with_extension("html").strip_prefix(&root_dir)?);
if x_path.extension().is_some_and(|ext| ext == "md") {
let result_path =
output_dir.join(x_path.with_extension("html").strip_prefix(&root_dir)?);
let md = fs::read_to_string(x_path)?;
let html = md_to_html(&md, x_path.parent().unwrap(), web_prefix)?;
let _ = std::fs::create_dir_all(result_path.parent().unwrap());
Expand All @@ -71,6 +71,7 @@ fn generate(root_dir: &Path, output_dir: &Path, web_prefix: Option<&str>) -> any
anyhow::bail!(e);
}
} else {
let result_path = output_dir.join(x_path.strip_prefix(&root_dir)?);
let _ = std::fs::create_dir_all(result_path.parent().unwrap());
if let Err(e) = std::fs::copy(x_path, &result_path) {
log::error!(
Expand Down

0 comments on commit 55c82d3

Please sign in to comment.