fix: refuse to copy assets that are already in the build output
This creates an error, and technically the source and destination are the same.
Fixes
@@ -157,6 +157,13 @@ fn copy_assets(assets_canister_info: &AssetsCanisterInfo) -> DfxResult {
let destination = output_assets_path.join(relative);
+ // If the destination exists, we simply continue. We delete the output directory
+ // prior to building so the only way this exists is if it's an output to one
+ // of the build steps.
+ if destination.exists() {
+ continue;
+ }
+
if entry.file_type().is_dir() {
fs::create_dir(destination)?;
} else {
