Changed -[MYDirectoryEvent relativePath] to work on standardised paths, in case symlinks are used. Fixes issue #28 in Murky.
1.1 --- a/MYDirectoryWatcher.m Sun May 10 18:57:43 2009 -0700
1.2 +++ b/MYDirectoryWatcher.m Tue May 12 14:38:30 2009 +0200
1.3 @@ -191,13 +191,14 @@
1.4
1.5 - (NSString*) relativePath
1.6 {
1.7 - NSString *base = watcher.path;
1.8 - if( ! [path hasPrefix: base] )
1.9 + NSString *base = [watcher.path stringByStandardizingPath];
1.10 + NSString *standardizedPath = [path stringByStandardizingPath];
1.11 + if( ! [standardizedPath hasPrefix: base] )
1.12 return nil;
1.13 unsigned length = base.length;
1.14 - while( length < path.length && [path characterAtIndex: length]=='/' )
1.15 + while( length < standardizedPath.length && [standardizedPath characterAtIndex: length]=='/' )
1.16 length++;
1.17 - return [path substringFromIndex: length];
1.18 + return [standardizedPath substringFromIndex: length];
1.19 }
1.20
1.21 - (BOOL) mustScanSubdirectories {return (flags & kFSEventStreamEventFlagMustScanSubDirs) != 0;}