1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/MYDirectoryWatcher.h Tue Apr 07 11:13:25 2009 -0700
1.3 @@ -0,0 +1,57 @@
1.4 +//
1.5 +// MYDirectoryWatcher.h
1.6 +// Murky
1.7 +//
1.8 +// Copyright 2008 Jens Alfke. All rights reserved.
1.9 +//
1.10 +
1.11 +#import <Cocoa/Cocoa.h>
1.12 +
1.13 +
1.14 +/* A wrapper for FSEvents, which notifies its delegate when filesystem changes occur. */
1.15 +@interface MYDirectoryWatcher : NSObject
1.16 +{
1.17 + NSString *_path;
1.18 + id _target;
1.19 + SEL _action;
1.20 + UInt64 _lastEventID;
1.21 + BOOL _historyDone;
1.22 + CFTimeInterval _latency;
1.23 + FSEventStreamRef _stream;
1.24 +}
1.25 +
1.26 +- (id) initWithDirectory: (NSString*)path target: (id)target action: (SEL)action;
1.27 +
1.28 +@property (readonly,nonatomic) NSString* path;
1.29 +
1.30 +@property UInt64 lastEventID;
1.31 +@property CFTimeInterval latency;
1.32 +
1.33 +- (BOOL) start;
1.34 +- (void) pause;
1.35 +- (void) stop;
1.36 +- (void) stopTemporarily; // stop, but re-start on next runloop cycle
1.37 +
1.38 +@end
1.39 +
1.40 +
1.41 +
1.42 +@interface MYDirectoryEvent : NSObject
1.43 +{
1.44 + MYDirectoryWatcher *watcher;
1.45 + NSString *path;
1.46 + UInt64 eventID;
1.47 + UInt32 flags;
1.48 +}
1.49 +
1.50 +@property (readonly, nonatomic) MYDirectoryWatcher *watcher;
1.51 +@property (readonly, nonatomic) NSString *path, *relativePath;
1.52 +@property (readonly, nonatomic) UInt64 eventID;
1.53 +@property (readonly, nonatomic) UInt32 flags;
1.54 +
1.55 +@property (readonly, nonatomic) BOOL mustScanSubdirectories;
1.56 +@property (readonly, nonatomic) BOOL eventsWereDropped;
1.57 +@property (readonly, nonatomic) BOOL isHistorical;
1.58 +@property (readonly, nonatomic) BOOL rootChanged;
1.59 +
1.60 +@end