This commit is contained in:
sxyazi 2025-06-18 19:26:58 +08:00
parent 624eb4fb25
commit 054b93db56
No known key found for this signature in database
2 changed files with 7 additions and 5 deletions

View file

@ -43,10 +43,9 @@ impl Watcher {
}
#[cfg(any(target_os = "linux", target_os = "macos"))]
yazi_fs::mounts::Partitions::monitor(
yazi_fs::mounts::PARTITIONS.clone(),
yazi_dds::Pubsub::pub_from_mount,
);
yazi_fs::mounts::Partitions::monitor(yazi_fs::mounts::PARTITIONS.clone(), || {
yazi_macro::err!(yazi_dds::Pubsub::pub_from_mount())
});
tokio::spawn(Self::fan_out(out_rx));
Self { in_tx, out_tx }

View file

@ -12,7 +12,10 @@ use yazi_shared::natsort;
use super::{Locked, Partition, Partitions};
impl Partitions {
pub fn monitor(me: Locked, cb: fn() -> Result<()>) {
pub fn monitor<F>(me: Locked, cb: F)
where
F: Fn() + Copy + Send + 'static,
{
tokio::task::spawn_blocking(move || {
let session = unsafe { DASessionCreate(kCFAllocatorDefault) };
if session.is_null() {