mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
Use error kind to determine if a watch is not found
This commit is contained in:
parent
1fd452f6b6
commit
6a6e44b6fe
1 changed files with 8 additions and 1 deletions
|
|
@ -72,7 +72,14 @@ impl Watcher {
|
||||||
(old.difference(new).cloned().collect(), new.difference(old).cloned().collect())
|
(old.difference(new).cloned().collect(), new.difference(old).cloned().collect())
|
||||||
};
|
};
|
||||||
|
|
||||||
to_unwatch.retain(|u| watcher.unwatch(u).is_ok() || !u.exists());
|
to_unwatch.retain(|u| match watcher.unwatch(u) {
|
||||||
|
Ok(_) => true,
|
||||||
|
Err(e) if matches!(e.kind, notify::ErrorKind::WatchNotFound) => true,
|
||||||
|
Err(e) => {
|
||||||
|
error!("Unwatch failed: {e:?}");
|
||||||
|
false
|
||||||
|
}
|
||||||
|
});
|
||||||
to_watch.retain(|u| watcher.watch(u, RecursiveMode::NonRecursive).is_ok());
|
to_watch.retain(|u| watcher.watch(u, RecursiveMode::NonRecursive).is_ok());
|
||||||
|
|
||||||
{
|
{
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue