From 1baf4ced66beb9c5d8dcdde85293a2a77fcefdbb Mon Sep 17 00:00:00 2001 From: Petter Rasmussen Date: Sun, 28 Aug 2022 14:14:12 +0300 Subject: [PATCH] Skip existing files --- src/project.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/project.rs b/src/project.rs index 3ab8755..625f5d0 100644 --- a/src/project.rs +++ b/src/project.rs @@ -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(()) }