mirror of
https://github.com/PR0M3TH3AN/Marlin.git
synced 2025-09-08 07:08:44 +00:00
Fix rename debouncer to preserve paths
This commit is contained in:
@@ -158,16 +158,25 @@ impl EventDebouncer {
|
|||||||
.retain(|p, _| !p.starts_with(&path) || p == &path);
|
.retain(|p, _| !p.starts_with(&path) || p == &path);
|
||||||
}
|
}
|
||||||
|
|
||||||
match self.events.get_mut(&path) {
|
use std::collections::hash_map::Entry;
|
||||||
Some(existing) => {
|
|
||||||
|
match self.events.entry(path) {
|
||||||
|
Entry::Occupied(mut o) => {
|
||||||
|
let existing = o.get_mut();
|
||||||
if event.priority < existing.priority {
|
if event.priority < existing.priority {
|
||||||
existing.priority = event.priority;
|
existing.priority = event.priority;
|
||||||
}
|
}
|
||||||
existing.kind = event.kind;
|
existing.kind = event.kind;
|
||||||
existing.timestamp = event.timestamp;
|
existing.timestamp = event.timestamp;
|
||||||
|
if let Some(old_p) = event.old_path {
|
||||||
|
existing.old_path = Some(old_p);
|
||||||
|
}
|
||||||
|
if let Some(new_p) = event.new_path {
|
||||||
|
existing.new_path = Some(new_p);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
None => {
|
Entry::Vacant(v) => {
|
||||||
self.events.insert(path, event);
|
v.insert(event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user