use std::path::Path;
pub struct BadAction {
delete: bool,
}
impl BadAction {
pub fn new(delete: bool) -> Self {
Self { delete }
}
pub fn on_bad_file(&self, path: &Path) {
if self.delete {
match std::fs::remove_file(path) {
Ok(_) => {
println!("[DELETED] {}", path.display());
}
Err(_) => {
println!("[BAD] {}", path.display());
log::error!(path:?; "Failed to delete file");
}
}
} else {
println!("[BAD] {}", path.display())
}
}
}