mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-04-29 10:07:58 +00:00
56c2fe8c0c
* Parallelize over cases * Rename the state and driver * Parallelize execution * Update the default config of the tool * Make codebase async * Fix machete * Fix tests & clear node directories before startup * Cleanup the cleanup logic * Rename geth node
23 lines
566 B
Rust
23 lines
566 B
Rust
use std::{
|
|
fs::{read_dir, remove_dir_all, remove_file},
|
|
path::Path,
|
|
};
|
|
|
|
use anyhow::Result;
|
|
|
|
/// This method clears the passed directory of all of the files and directories contained within
|
|
/// without deleting the directory.
|
|
pub fn clear_directory(path: impl AsRef<Path>) -> Result<()> {
|
|
for entry in read_dir(path.as_ref())? {
|
|
let entry = entry?;
|
|
let entry_path = entry.path();
|
|
|
|
if entry_path.is_file() {
|
|
remove_file(entry_path)?
|
|
} else {
|
|
remove_dir_all(entry_path)?
|
|
}
|
|
}
|
|
Ok(())
|
|
}
|