mirror of
https://github.com/tauri-apps/plugins-workspace.git
synced 2026-08-07 18:28:39 +02:00
fix(fs): missing debouncer rename cache (#1245)
* Fix missing debouncer rename cache * Add change file * Format
This commit is contained in:
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
"fs": patch
|
||||||
|
---
|
||||||
|
|
||||||
|
Fixes `RenameMode::From` and `RenameMode::To` never getting converted to `RenameMode::Both` when using `watch` with a debounce on Windows
|
||||||
@@ -100,7 +100,7 @@ pub async fn watch<R: Runtime>(
|
|||||||
)?);
|
)?);
|
||||||
}
|
}
|
||||||
|
|
||||||
let mode = if options.recursive {
|
let recursive_mode = if options.recursive {
|
||||||
RecursiveMode::Recursive
|
RecursiveMode::Recursive
|
||||||
} else {
|
} else {
|
||||||
RecursiveMode::NonRecursive
|
RecursiveMode::NonRecursive
|
||||||
@@ -110,7 +110,8 @@ pub async fn watch<R: Runtime>(
|
|||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?;
|
let mut debouncer = new_debouncer(Duration::from_millis(delay), None, tx)?;
|
||||||
for path in &resolved_paths {
|
for path in &resolved_paths {
|
||||||
debouncer.watcher().watch(path.as_ref(), mode)?;
|
debouncer.watcher().watch(path.as_ref(), recursive_mode)?;
|
||||||
|
debouncer.cache().add_root(path, recursive_mode);
|
||||||
}
|
}
|
||||||
watch_debounced(on_event, rx);
|
watch_debounced(on_event, rx);
|
||||||
WatcherKind::Debouncer(debouncer)
|
WatcherKind::Debouncer(debouncer)
|
||||||
@@ -118,7 +119,7 @@ pub async fn watch<R: Runtime>(
|
|||||||
let (tx, rx) = channel();
|
let (tx, rx) = channel();
|
||||||
let mut watcher = RecommendedWatcher::new(tx, Config::default())?;
|
let mut watcher = RecommendedWatcher::new(tx, Config::default())?;
|
||||||
for path in &resolved_paths {
|
for path in &resolved_paths {
|
||||||
watcher.watch(path.as_ref(), mode)?;
|
watcher.watch(path.as_ref(), recursive_mode)?;
|
||||||
}
|
}
|
||||||
watch_raw(on_event, rx);
|
watch_raw(on_event, rx);
|
||||||
WatcherKind::Watcher(watcher)
|
WatcherKind::Watcher(watcher)
|
||||||
|
|||||||
Reference in New Issue
Block a user