summaryrefslogtreecommitdiff
path: root/runtime/ops/fs_events.rs
diff options
context:
space:
mode:
authorLuca Casonato <hello@lcas.dev>2021-11-23 11:30:24 +0100
committerGitHub <noreply@github.com>2021-11-23 11:30:24 +0100
commitae34f8fa10f4daddde3d32cc63773d288253d4d4 (patch)
tree659e9796677c1a625a0b8b53f7b5bd805227f404 /runtime/ops/fs_events.rs
parent2eae1ae665ff601b86e936ad9d80cfa57831ce88 (diff)
fix: support "other" event type in FSWatcher (#12836)
This commit adds support for "other" events in `FSWatcher`. Flags on events are now exposed via the `flag` property on `FsEvent`.
Diffstat (limited to 'runtime/ops/fs_events.rs')
-rw-r--r--runtime/ops/fs_events.rs12
1 files changed, 8 insertions, 4 deletions
diff --git a/runtime/ops/fs_events.rs b/runtime/ops/fs_events.rs
index 30c6d3aaa..26ad255fd 100644
--- a/runtime/ops/fs_events.rs
+++ b/runtime/ops/fs_events.rs
@@ -65,8 +65,9 @@ impl Resource for FsEventsResource {
/// the complexity.
#[derive(Serialize, Debug)]
struct FsEvent {
- kind: String,
+ kind: &'static str,
paths: Vec<PathBuf>,
+ flag: Option<&'static str>,
}
impl From<NotifyEvent> for FsEvent {
@@ -77,12 +78,15 @@ impl From<NotifyEvent> for FsEvent {
EventKind::Create(_) => "create",
EventKind::Modify(_) => "modify",
EventKind::Remove(_) => "remove",
- EventKind::Other => todo!(), // What's this for? Leaving it out for now.
- }
- .to_string();
+ EventKind::Other => "other",
+ };
+ let flag = e.flag().map(|f| match f {
+ notify::event::Flag::Rescan => "rescan",
+ });
FsEvent {
kind,
paths: e.paths,
+ flag,
}
}
}