mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
fix: can't rewatch a directory that has been deleted once before (#1335)
Co-authored-by: sxyazi <sxyazi@gmail.com>
This commit is contained in:
parent
df1f094a28
commit
c086f2f34d
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());
|
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