ksud: fix incorrecy RAII

This commit is contained in:
tiann
2023-02-02 19:21:37 +08:00
parent dc902b16d4
commit 0bc36b3299
3 changed files with 11 additions and 2 deletions

View File

@@ -8,7 +8,9 @@ use std::{
pub fn ensure_clean_dir(dir: &str) -> Result<()> {
let path = Path::new(dir);
log::debug!("ensure_clean_dir: {}", path.display());
if path.exists() {
log::debug!("ensure_clean_dir: {} exists, remove it", path.display());
std::fs::remove_dir_all(path)?;
}
Ok(std::fs::create_dir_all(path)?)