Skip to content

Commit

Permalink
handle base dir not found
Browse files Browse the repository at this point in the history
  • Loading branch information
viperML committed Oct 1, 2023
1 parent b43f290 commit 9a2be0a
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion src/clean.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::collections::HashMap;
use std::io::ErrorKind;
use std::os::unix::process::CommandExt;
use std::path::{Component, Path, PathBuf};
use std::time::SystemTime;
Expand Down Expand Up @@ -159,7 +160,19 @@ where
let mut profiles: HashMap<PathBuf, Vec<Generation>> = HashMap::new();

for base_dir in base_dirs {
let read = std::fs::read_dir(base_dir)?;
// let read = std::fs::read_dir(base_dir)?;
let read = match std::fs::read_dir(base_dir) {
Ok(inner) => inner,
Err(inner) => match inner.kind() {
ErrorKind::NotFound => {
debug!("Base dir not found!");
continue;
}
_ => Err(inner)
.context(base_dir.as_ref().to_str().unwrap().to_string())
.context("Reading base dir")?,
},
};

for entry in read {
// let x = x.await;
Expand Down

0 comments on commit 9a2be0a

Please sign in to comment.