I'm using this (older) framework: https://github.com/rastersize/CDEvents to track changes on the filesystem.
For some reason the flag is always event.isGenericChange
. On the FSEvent
level this would be the kFSEventStreamEventFlagNone
(code 0
).
Maybe this has something to do with the framework being older and missing something that changed? I'm not getting any build/test warnings/errors (installed through CocoaPods).
I'm using this code through a delegate:
- (void)viewDidLoad {
[super viewDidLoad];
self.events = [[CDEvents alloc] initWithURLs:@[[NSURL URLWithString:@"/Users/username/Desktop/"]]
delegate:self
onRunLoop:[NSRunLoop currentRunLoop]
sinceEventIdentifier:kCDEventsSinceEventNow
notificationLantency:((NSTimeInterval)0.25)
ignoreEventsFromSubDirs:NO
excludeURLs:@[]
streamCreationFlags:kCDEventsDefaultEventStreamFlags];
}
- (void)URLWatcher:(CDEvents *)URLWatcher eventOccurred:(CDEvent *)event {
NSLog(@"Event: %ld", (unsigned long)event.flags);
}
I tried all actions (rename, edit, remove, create, change meta-data, change rights, etc.) and it's always genericChange
.
Fixed it by adding the kFSEventStreamCreateFlagFileEvents
flag. Because I'm using CocoaPods I'd rather not adjust the source code so instead of placing streamCreationFlags:kCDEventsDefaultEventStreamFlags
using these manual flags:
(kFSEventStreamCreateFlagUseCFTypes |
kFSEventStreamCreateFlagWatchRoot |
kFSEventStreamCreateFlagFileEvents)
Guess it has to do with some radical changes Apple did sometime in the past. I'm now getting the correct flags and also the full path to a file (not only it's directory).