bugfix for nonexisting trashed item paths
Build/Publish XBPS / build-and-publish (push) Successful in 11s Details

This commit is contained in:
Luca Bilke 2024-05-03 10:51:25 +02:00
parent 32b34f634c
commit 877e9f952c
No known key found for this signature in database
GPG Key ID: AD6630D0A1E650AC
1 changed files with 5 additions and 1 deletions

View File

@ -31,7 +31,11 @@ fn list<P: Fn(&trash::TrashItem) -> bool>(predicate: P) -> Vec<trash::TrashItem>
fn print_list(path: Option<PathBuf>) {
let predicate: Box<dyn Fn(&trash::TrashItem) -> bool> = match &path {
Some(p) => Box::new(|item| {
*p.canonicalize().unwrap() == item.original_parent.canonicalize().unwrap()
let orig = match item.original_parent.canonicalize() {
Ok(p) => p,
Err(_) => item.original_parent.clone(),
};
*p.canonicalize().unwrap() == orig
}),
None => Box::new(|_| true),
};