From bb83e47fe4a8421d74122db650bbffd8a70a4f9c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mart=C3=ADn=20Lucas=20Golini?= Date: Wed, 14 Oct 2026 21:38:39 -0300 Subject: [PATCH] fix(vfs): match FSEvents' resolved paths in local watches on macOS FSEvents reports events under the watched directory's real path (/private/var/... for a root under /var, such as the temporary directory), so local watch events kept absolute paths instead of paths relative to the watched root. Keep the resolved root when it differs and strip whichever prefix the event path starts with. Update efsw for the same fix in efsw-agent. --- .../src/eepp/vfs/watchers/localwatchbackend.cpp | 17 +++++++++++++++-- src/thirdparty/efsw | 2 +- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/src/modules/vfs/src/eepp/vfs/watchers/localwatchbackend.cpp b/src/modules/vfs/src/eepp/vfs/watchers/localwatchbackend.cpp index 6d72b491f..e33d006d0 100644 --- a/src/modules/vfs/src/eepp/vfs/watchers/localwatchbackend.cpp +++ b/src/modules/vfs/src/eepp/vfs/watchers/localwatchbackend.cpp @@ -81,6 +81,13 @@ class LocalWatchBackendImpl : public std::enable_shared_from_this lock( mEntriesMutex ); Entry& entry = mEntries[composite]; entry.rootPath = root; +#if EE_PLATFORM == EE_PLATFORM_MACOS + // FSEvents reports resolved paths: /private/var/... for a root under /var. + std::string realRoot( System::FileSystem::getRealPath( nativeRoot ) ); + System::FileSystem::dirAddSlashAtEnd( realRoot ); + if ( realRoot != root ) + entry.realRootPath = std::move( realRoot ); +#endif entry.recursive = options.recursive; entry.sinks.emplace_back( token, sink ); auto& highest = mHighestId[key]; @@ -142,8 +149,11 @@ class LocalWatchBackendImpl : public std::enable_shared_from_thissecond.rootPath; - for ( auto& sink : it->second.sinks ) + const Entry& entry = it->second; + root = !entry.realRootPath.empty() && String::startsWith( dir, entry.realRootPath ) + ? entry.realRootPath + : entry.rootPath; + for ( auto& sink : entry.sinks ) if ( auto locked = sink.second.lock() ) sinks.push_back( std::move( locked ) ); } @@ -225,6 +235,9 @@ class LocalWatchBackendImpl : public std::enable_shared_from_this>> sinks; bool recursive{ false }; }; diff --git a/src/thirdparty/efsw b/src/thirdparty/efsw index 36c57df5a..58a105f56 160000 --- a/src/thirdparty/efsw +++ b/src/thirdparty/efsw @@ -1 +1 @@ -Subproject commit 36c57df5a2d713e1b087439f6d1a19d064c21056 +Subproject commit 58a105f56aa8dcc1a8771121bd196c7e2c6e4ef1