Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 12 additions & 11 deletions src/efsw/FileWatcherInotify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,17 @@ WatchID FileWatcherInotify::addWatch( const std::string& directory, FileWatchLis

if ( pWatch->Recursive ) {
std::map<std::string, FileInfo> files = FileSystem::filesInfoFromPath( pWatch->Directory );

if ( fromInternalEvent && parent != NULL && syntheticEvents ) {
for ( const auto& file : files ) {
if ( file.second.isRegularFile() || file.second.isDirectory() || file.second.isLink() ) {
pWatch->Listener->handleFileAction(
pWatch->ID, pWatch->Directory,
FileSystem::fileNameFromPath( file.second.Filepath ), Actions::Add );
}
}
}

std::map<std::string, FileInfo>::iterator it = files.begin();

for ( ; it != files.end(); ++it ) {
Expand All @@ -163,17 +174,7 @@ WatchID FileWatcherInotify::addWatch( const std::string& directory, FileWatchLis
const FileInfo& cfi = it->second;

if ( cfi.isDirectory() && cfi.isReadable() ) {
addWatch( cfi.Filepath, watcher, recursive, syntheticEvents, pWatch );
}
}

if ( fromInternalEvent && parent != NULL && syntheticEvents ) {
for ( const auto& file : files ) {
if ( file.second.isRegularFile() ) {
pWatch->Listener->handleFileAction(
pWatch->ID, pWatch->Directory,
FileSystem::fileNameFromPath( file.second.Filepath ), Actions::Add );
}
addWatch( cfi.Filepath, watcher, recursive, syntheticEvents, pWatch, fromInternalEvent );
}
}
}
Expand Down