Skip to content

Commit

Permalink
fix: exit with error when the file to be removed does not exist
Browse files Browse the repository at this point in the history
  • Loading branch information
someoneonsmile committed Oct 25, 2024
1 parent e739dc1 commit 0fc102f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/symlink.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,11 @@ impl Symlink {

pub(crate) async fn remove(&self) -> Result<()> {
if !self.dst.is_symlink() {
return Err(anyhow!("{} is not symlink", self.dst.to_string_lossy()));
if self.dst.exists() {
return Err(anyhow!("{} is not symlink", self.dst.to_string_lossy()));
} else {
return Ok(());
}
}
fs::remove_file(&self.dst)
.await
Expand Down

0 comments on commit 0fc102f

Please sign in to comment.