Commits

Olivier Scherler  committed 2befbe3

Changed -[MYDirectoryEvent relativePath] to work on standardised paths, in case symlinks are used. Fixes issue #28 in Murky.

  • Participants
  • Parent commits 8874aff

Comments (0)

Files changed (1)

File MYDirectoryWatcher.m

 
 - (NSString*) relativePath
 {
-    NSString *base = watcher.path;
-    if( ! [path hasPrefix: base] )
+    NSString *base = [watcher.path stringByStandardizingPath];
+    NSString *standardizedPath = [path stringByStandardizingPath];
+    if( ! [standardizedPath hasPrefix: base] )
         return nil;
     unsigned length = base.length;
-    while( length < path.length && [path characterAtIndex: length]=='/' )
+    while( length < standardizedPath.length && [standardizedPath characterAtIndex: length]=='/' )
         length++;
-    return [path substringFromIndex: length];
+    return [standardizedPath substringFromIndex: length];
 }
 
 - (BOOL) mustScanSubdirectories     {return (flags & kFSEventStreamEventFlagMustScanSubDirs) != 0;}