Skip to content

Commit e6ba2d2

Browse files
committed
fix
1 parent 9740361 commit e6ba2d2

File tree

4 files changed

+35
-36
lines changed

4 files changed

+35
-36
lines changed

Cargo.lock

Lines changed: 25 additions & 28 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/src-tauri/capabilities/desktop.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
"updater:default",
1010
"global-shortcut:allow-unregister",
1111
"global-shortcut:allow-register",
12-
"global-shortcut:allow-unregister-all"
12+
"global-shortcut:allow-unregister-all",
13+
{ "identifier": "fs:allow-watch", "allow": ["*", "**/*"] },
14+
"fs:allow-unwatch"
1315
]
1416
}

plugins/fs/Cargo.toml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@ url = { workspace = true }
3535
anyhow = "1"
3636
uuid = { version = "1", features = ["v4"] }
3737
glob = "0.3"
38-
notify = { version = "7", optional = true, features = ["serde"] }
39-
notify-debouncer-full = { version = "0.3", optional = true }
38+
# TODO: Remove `serialization-compat-6` in v3
39+
notify = { version = "7", optional = true, features = ["serde", "serialization-compat-6"] }
40+
notify-debouncer-full = { version = "0.4", optional = true }
4041
dunce = { workspace = true }
4142
percent-encoding = "2"
4243

plugins/fs/src/watcher.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -111,16 +111,15 @@ pub async fn watch<R: Runtime>(
111111
let (tx, rx) = channel();
112112
let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?;
113113
for path in &resolved_paths {
114-
debouncer.watcher().watch(path.as_ref(), recursive_mode)?;
115-
debouncer.cache().add_root(path, recursive_mode);
114+
debouncer.watch(path, recursive_mode)?;
116115
}
117116
watch_debounced(on_event, rx);
118117
WatcherKind::Debouncer(debouncer)
119118
} else {
120119
let (tx, rx) = channel();
121120
let mut watcher = RecommendedWatcher::new(tx, Config::default())?;
122121
for path in &resolved_paths {
123-
watcher.watch(path.as_ref(), recursive_mode)?;
122+
watcher.watch(path, recursive_mode)?;
124123
}
125124
watch_raw(on_event, rx);
126125
WatcherKind::Watcher(watcher)
@@ -140,14 +139,14 @@ pub async fn unwatch<R: Runtime>(webview: Webview<R>, rid: ResourceId) -> Comman
140139
match &mut watcher.kind {
141140
WatcherKind::Debouncer(ref mut debouncer) => {
142141
for path in &watcher.paths {
143-
debouncer.watcher().unwatch(path.as_ref()).map_err(|e| {
142+
debouncer.unwatch(path).map_err(|e| {
144143
format!("failed to unwatch path: {} with error: {e}", path.display())
145144
})?;
146145
}
147146
}
148147
WatcherKind::Watcher(ref mut w) => {
149148
for path in &watcher.paths {
150-
w.unwatch(path.as_ref()).map_err(|e| {
149+
w.unwatch(path).map_err(|e| {
151150
format!("failed to unwatch path: {} with error: {e}", path.display())
152151
})?;
153152
}

0 commit comments

Comments
 (0)