diff --git a/ethers-solc/src/lib.rs b/ethers-solc/src/lib.rs index a1e2565d..374f0211 100644 --- a/ethers-solc/src/lib.rs +++ b/ethers-solc/src/lib.rs @@ -364,6 +364,17 @@ impl Project { self.ignored_error_codes.clone(), )) } + + /// Removes the project's artifacts and cache file + pub fn cleanup(&self) -> Result<()> { + if self.paths.cache.exists() { + std::fs::remove_dir_all(&self.paths.cache)?; + } + if self.paths.artifacts.exists() { + std::fs::remove_dir_all(&self.paths.artifacts)?; + } + Ok(()) + } } fn apply_mappings(sources: Sources, mut mappings: HashMap) -> Sources {