jens@20: // jens@20: // MYDirectoryWatcher.h jens@20: // Murky jens@20: // jens@20: // Copyright 2008 Jens Alfke. All rights reserved. jens@20: // jens@20: jens@20: #import jens@20: jens@20: jens@20: /* A wrapper for FSEvents, which notifies its delegate when filesystem changes occur. */ jens@20: @interface MYDirectoryWatcher : NSObject jens@20: { jens@20: NSString *_path; jens@20: id _target; jens@20: SEL _action; jens@20: UInt64 _lastEventID; jens@20: BOOL _historyDone; jens@20: CFTimeInterval _latency; jens@20: FSEventStreamRef _stream; jens@20: } jens@20: jens@20: - (id) initWithDirectory: (NSString*)path target: (id)target action: (SEL)action; jens@20: jens@20: @property (readonly,nonatomic) NSString* path; jens@20: jens@20: @property UInt64 lastEventID; jens@20: @property CFTimeInterval latency; jens@20: jens@20: - (BOOL) start; jens@20: - (void) pause; jens@20: - (void) stop; jens@20: - (void) stopTemporarily; // stop, but re-start on next runloop cycle jens@20: jens@20: @end jens@20: jens@20: jens@20: jens@20: @interface MYDirectoryEvent : NSObject jens@20: { jens@20: MYDirectoryWatcher *watcher; jens@20: NSString *path; jens@20: UInt64 eventID; jens@20: UInt32 flags; jens@20: } jens@20: jens@20: @property (readonly, nonatomic) MYDirectoryWatcher *watcher; jens@20: @property (readonly, nonatomic) NSString *path, *relativePath; jens@20: @property (readonly, nonatomic) UInt64 eventID; jens@20: @property (readonly, nonatomic) UInt32 flags; jens@20: jens@20: @property (readonly, nonatomic) BOOL mustScanSubdirectories; jens@20: @property (readonly, nonatomic) BOOL eventsWereDropped; jens@20: @property (readonly, nonatomic) BOOL isHistorical; jens@20: @property (readonly, nonatomic) BOOL rootChanged; jens@20: jens@20: @end