Hi,
[Note: The title may be less than accurate, I didn't know how else to phrase it] For some reason NSFileHandle's readInBackground didn't work so I resorted to SCEvents, a Cocoa wrapper around Mac OS X's FSEvents API. I have a separate class called "EventListener" that handles all the SCEvents stuff.
It has these methods:
- (void)setupEventlistener
{
SCEvents *events = [SCEvents sharedPathWatcher];
[events setDelegate:self];
NSMutableArray *paths = [NSMutableArray arrayWithObject:NSHomeDirectory()];
NSMutableArray *excludePaths = [NSMutableArray arrayWithObject:[NSHomeDirectory() stringByAppendingString:@"/Downloads"]];
[events setExcludedPaths:excludePaths];
[events startWatchingPaths:paths];
}
- (void)pathWatcher:(SCEvents *)pathWatcher eventOccurred:(SCEvent *)event
{
NSLog(@"%@", event);
}
( I got these methods directly from the SCEvents example app, once I get this to work I plan to change it for my own purposes )
Then in the applicationDidFinishLaunching method of my main app delegate class I have this:
EventListener *events = [[EventListener alloc] init];
[events setupEventlistener];
Which initializes the listener. Now, after allocing it and calling the setupEventListener class, everything works fine. Changes inside the home folder are logged into the debugger console as they should be. I have another method called format: that runs some shell scripts . The issue is, when the format method is running the event listener stops working. Any changes to the home folder are NOT logged. This problem only happens with the format: method. With all other methods the event listener works fine.
I'm not sure what the problem is. Thanks