feat(solc): add clean up function (#649)

This commit is contained in:
Matthias Seitz 2021-12-04 18:27:30 +01:00 committed by GitHub
parent 0464ac9d46
commit 23c356ce38
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 11 additions and 0 deletions

View File

@ -364,6 +364,17 @@ impl<Artifacts: ArtifactOutput> Project<Artifacts> {
self.ignored_error_codes.clone(), 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<PathBuf, PathBuf>) -> Sources { fn apply_mappings(sources: Sources, mut mappings: HashMap<PathBuf, PathBuf>) -> Sources {