fix crash when given file doesn't exist

This commit is contained in:
H. Emre ARI 2019-03-27 16:21:03 +03:00 committed by Pierre Peltier
parent b0c75f47cf
commit 4485087759

View file

@ -67,8 +67,16 @@ impl Core {
};
for path in paths {
let absolute_path = match fs::canonicalize(&path) {
Ok(path) => path,
Err(err) => {
println!("couldn't access '{}': {}", path.display(), err);
continue;
}
};
match Meta::from_path_recursive(
&fs::canonicalize(&path.to_path_buf()).unwrap(),
&fs::canonicalize(&absolute_path.to_path_buf()).unwrap(),
depth,
self.flags.display_all,
) {