mirror of https://github.com/lapce/lapce.git
1. Fix the PathBuf value in file monitoring events in the Windows environment (#3538)
This commit is contained in:
parent
b6d11b39dc
commit
ea9b7a9c9c
|
@ -1266,8 +1266,19 @@ fn handle_fs_events(&self, events: Vec<(WatchToken, notify::Event)>) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fn handle_open_file_fs_event(&self, event: notify::Event) {
|
fn handle_open_file_fs_event(&self, event: notify::Event) {
|
||||||
|
const PREFIX: &str = r"\\?\";
|
||||||
if event.kind.is_modify() {
|
if event.kind.is_modify() {
|
||||||
for path in event.paths {
|
for path in event.paths {
|
||||||
|
#[cfg(windows)]
|
||||||
|
if let Some(path_str) = path.to_str() {
|
||||||
|
if path_str.starts_with(PREFIX) {
|
||||||
|
let path = PathBuf::from(&path_str[PREFIX.len()..]);
|
||||||
|
self.proxy_rpc.notification(
|
||||||
|
ProxyNotification::OpenFileChanged { path },
|
||||||
|
);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
self.proxy_rpc
|
self.proxy_rpc
|
||||||
.notification(ProxyNotification::OpenFileChanged { path });
|
.notification(ProxyNotification::OpenFileChanged { path });
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue