My application has few objects which watch for certain changes in few folders. FSEvents library is used.
The problem is I don't see easy way to get monitored path(s) in some watchers in fsevents_callback. Maybe it's trivial, yet reference to self (where monitored path is stored) is not available in this callback and inside this callback is way too less information available to identify enclosing object.
void fsevents_callback(ConstFSEventStreamRef streamRef, void *clientCallBackInfo, size_t numEvents, NSArray *eventPaths, const FSEventStreamEventFlags eventFlags[], const
FSEventStreamEventId eventIds[]) {
size_t i;
for (i = 0; i < numEvents; ++i)
{
NSString *processedPath = [eventPaths objectAtIndex:i];
{
//if ([processedPath isEqualToString: path]) {
void (^block)() = (__bridge void (^)())(clientCallBackInfo);
block();
//do something else & break }
}
}
}
You can use FSEventStreamCopyPathsBeingWatched
function.
Fetches the paths supplied when the stream was created via one of the FSEventStreamCreate...() functions.
If you want self object inside call back function, you should pass self in clientCallBackInfo.