diff --git a/core/src/location/manager/watcher/macos.rs b/core/src/location/manager/watcher/macos.rs index 31aad1d9f..2459eb67b 100644 --- a/core/src/location/manager/watcher/macos.rs +++ b/core/src/location/manager/watcher/macos.rs @@ -8,7 +8,6 @@ use notify::{ event::{CreateKind, DataChange, ModifyKind, RenameMode}, Event, EventKind, }; -use tokio::{fs, io}; use tracing::trace; use super::{ diff --git a/core/src/location/manager/watcher/mod.rs b/core/src/location/manager/watcher/mod.rs index a42792a9a..8c071978a 100644 --- a/core/src/location/manager/watcher/mod.rs +++ b/core/src/location/manager/watcher/mod.rs @@ -333,7 +333,10 @@ mod tests { Config, Event, EventKind, RecommendedWatcher, Watcher, }; use std::io::ErrorKind; - use std::{path::Path, time::Duration}; + use std::{ + path::{Path, PathBuf}, + time::Duration, + }; use tempfile::{tempdir, TempDir}; use tokio::{fs, io::AsyncWriteExt, sync::mpsc, time::sleep}; use tracing::{debug, error}; @@ -375,8 +378,10 @@ mod tests { Ok(maybe_event) => { let event = maybe_event.expect("Failed to receive event"); debug!("Received event: {event:#?}"); - // Using `ends_with` here due to a weird edge case on CI tests at MacOS - if event.paths[0].ends_with(path) && event.kind == expected_event { + // Using `ends_with` and removing root path here due to a weird edge case on CI tests at MacOS + if event.paths[0].ends_with(path.iter().skip(1).collect::()) + && event.kind == expected_event + { debug!("Received expected event: {expected_event:#?}"); break; }