Skip to content

Commit

Permalink
register for WatchRoot notification
Browse files Browse the repository at this point in the history
  • Loading branch information
jjallaire committed Aug 17, 2011
1 parent b41c797 commit 991a3b9
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion src/cpp/core/system/file_monitor/MacFileMonitor.cpp
Expand Up @@ -406,6 +406,13 @@ void fileEventCallback(ConstFSEventStreamRef streamRef,
char **paths = (char**)eventPaths;
for (std::size_t i=0; i<numEvents; i++)
{
// check for root changed (unregister)
if (eventFlags[i] & kFSEventStreamEventFlagRootChanged)
{
unregisterMonitor((Handle)pContext);
return;
}

// make a copy of the path and strip off trailing / if necessary
std::string path(paths[i]);
boost::algorithm::trim_right_if(path, boost::algorithm::is_any_of("/"));
Expand Down Expand Up @@ -514,7 +521,8 @@ void registerMonitor(const core::FilePath& filePath, const Callbacks& callbacks)
pathsArrayRef,
kFSEventStreamEventIdSinceNow,
1,
kFSEventStreamCreateFlagNoDefer);
kFSEventStreamCreateFlagNoDefer |
kFSEventStreamCreateFlagWatchRoot);
if (pContext->streamRef == NULL)
{
callbacks.onRegistrationError(systemError(
Expand Down

0 comments on commit 991a3b9

Please sign in to comment.