Skip to content

Commit

Permalink
Skip existing files
Browse files Browse the repository at this point in the history
  • Loading branch information
prasmussen committed Aug 28, 2022
1 parent c5644d3 commit 1baf4ce
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/project.rs
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,12 @@ fn copy_page_template(
let new_file_name = format!("src/{}.{}", page_name.snake_case(), file_ext);
let new_file_path = base_path.join(new_file_name);

file_util::write(&new_file_path, page_file).map_err(Error::WriteCoreHomePage)?;
if new_file_path.exists() {
println!("Skipping existing file: {}", new_file_path.display());
} else {
println!("Adding file: {}", new_file_path.display());
file_util::write(&new_file_path, page_file).map_err(Error::WriteCoreHomePage)?;
}

Ok(())
}
Expand Down

0 comments on commit 1baf4ce

Please sign in to comment.