From c1f3c8f82d03ee604f1eaa13041672e47fcb623f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E9=9B=85=20=C2=B7=20Misaki=20Masa?= Date: Fri, 8 Sep 2023 22:44:45 +0800 Subject: [PATCH] fix: recognize symlink directories as files (#125) --- core/src/manager/watcher.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core/src/manager/watcher.rs b/core/src/manager/watcher.rs index 1e6c3fcd..f4bf91b1 100644 --- a/core/src/manager/watcher.rs +++ b/core/src/manager/watcher.rs @@ -134,13 +134,13 @@ impl Watcher { let rx = UnboundedReceiverStream::new(rx).chunks_timeout(100, Duration::from_millis(200)); pin!(rx); - while let Some(paths) = rx.next().await { + while let Some(urls) = rx.next().await { let (mut files, mut dirs): (Vec<_>, Vec<_>) = Default::default(); - for path in paths.into_iter().collect::>() { - if fs::symlink_metadata(&path).await.map(|m| !m.is_dir()).unwrap_or(false) { - files.push(path); + for url in urls.into_iter().collect::>() { + if fs::metadata(&url).await.map(|m| !m.is_dir()).unwrap_or(false) { + files.push(url); } else { - dirs.push(path); + dirs.push(url); } }