diff options
Diffstat (limited to 'src/commands/release.rs')
-rw-r--r-- | src/commands/release.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/commands/release.rs b/src/commands/release.rs index 6f0232b..50d3918 100644 --- a/src/commands/release.rs +++ b/src/commands/release.rs @@ -14,6 +14,7 @@ use std::io::Write; use std::path::PathBuf; use anyhow::anyhow; +use anyhow::Context; use anyhow::Error; use anyhow::Result; use clap::ArgMatches; @@ -165,9 +166,17 @@ async fn new_release( } } + if dest_path.exists() { + debug!("Removing {} before writing new file to this path", dest_path.display()); + tokio::fs::remove_file(&dest_path) + .await + .with_context(|| anyhow!("Removing {} before writing new file to this path", dest_path.display()))?; + } + // else !dest_path.exists() - tokio::fs::copy(art_path, &dest_path) + tokio::fs::copy(&art_path, &dest_path) .await + .with_context(|| anyhow!("Copying {} to {}", art_path.display(), dest_path.display())) .map_err(Error::from) .map(|_| (art, dest_path)) } |