mirror of
https://github.com/zed-industries/zed.git
synced 2025-01-26 03:59:55 +00:00
Ignore 'historical' events from fs event stream
Co-Authored-By: Nathan Sobo <nathan@zed.dev>
This commit is contained in:
parent
907b537a0b
commit
c1d35b099b
1 changed files with 14 additions and 8 deletions
|
@ -148,19 +148,25 @@ impl EventStream {
|
||||||
let path_c_str = CStr::from_ptr(paths[p]);
|
let path_c_str = CStr::from_ptr(paths[p]);
|
||||||
let path = PathBuf::from(OsStr::from_bytes(path_c_str.to_bytes()));
|
let path = PathBuf::from(OsStr::from_bytes(path_c_str.to_bytes()));
|
||||||
if let Some(flag) = StreamFlags::from_bits(flags[p]) {
|
if let Some(flag) = StreamFlags::from_bits(flags[p]) {
|
||||||
events.push(Event {
|
if flag.contains(StreamFlags::HISTORY_DONE) {
|
||||||
event_id: ids[p],
|
events.clear();
|
||||||
flags: flag,
|
} else {
|
||||||
path,
|
events.push(Event {
|
||||||
});
|
event_id: ids[p],
|
||||||
|
flags: flag,
|
||||||
|
path,
|
||||||
|
});
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
debug_assert!(false, "unknown flag set for fs event: {}", flags[p]);
|
debug_assert!(false, "unknown flag set for fs event: {}", flags[p]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if !callback(events) {
|
if !events.is_empty() {
|
||||||
fs::FSEventStreamStop(stream_ref);
|
if !callback(events) {
|
||||||
cf::CFRunLoopStop(cf::CFRunLoopGetCurrent());
|
fs::FSEventStreamStop(stream_ref);
|
||||||
|
cf::CFRunLoopStop(cf::CFRunLoopGetCurrent());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue