Skip to content

Commit

Permalink
fix(forge): only cleanup dirs if they exists
Browse files Browse the repository at this point in the history
  • Loading branch information
mattsse committed Dec 4, 2021
1 parent 18df4c6 commit 65ab824
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions cli/src/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,13 @@ pub fn find_dapp_json_contract(path: &str, name: &str) -> eyre::Result<Contract>
}

pub fn cleanup(root: PathBuf) -> eyre::Result<()> {
std::fs::remove_dir_all(root.join("cache"))?;
std::fs::remove_dir_all(root.join("out"))?;
let cache = root.join("cache");
if cache.exists() {
std::fs::remove_dir_all(cache)?;
}
let out = root.join("out");
if out.exists() {
std::fs::remove_dir_all(out)?;
}
Ok(())
}

0 comments on commit 65ab824

Please sign in to comment.