From 5954cbd03005d455e90eda2216c31cb690cb05a9 Mon Sep 17 00:00:00 2001 From: Tim Jentzsch Date: Mon, 23 Dec 2024 15:06:10 +0100 Subject: [PATCH] Clean up previous bundle if it exists --- src/web/bundle.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/web/bundle.rs b/src/web/bundle.rs index 459b139..cbad07e 100644 --- a/src/web/bundle.rs +++ b/src/web/bundle.rs @@ -91,9 +91,13 @@ pub fn create_web_bundle( .join(profile) .join(bin_target.bin_name); + // Remove the previous bundle + // The error can be ignored, because the folder doesn't need to exist yet + // and the files will also be overwritten if they already exist + let _ = fs::remove_dir_all(&base_path); + // Build artifacts fs::create_dir_all(base_path.join("build"))?; - println!("Create build folder"); fs::copy( linked.build_artifact_path.join(&linked.wasm_file_name), base_path.join("build").join(&linked.wasm_file_name),