1
2
3
4
5
6
7
8
9
10
11
12
13
14
use crate::error::*;

/// Helper function to delete files
pub fn remove(target: Vec<std::path::PathBuf>) -> Result<()> {
    target.iter().for_each(|content| {
        if content.exists() && content.is_file() {
            std::fs::remove_file(&content).unwrap();
        }
        if content.exists() && content.is_dir() {
            std::fs::remove_dir_all(&content).unwrap();
        }
    });
    Ok(())
}