simplify the ignored path matching

This commit is contained in:
Antoine Mercadal
2011-11-13 23:34:49 +01:00
parent 820531342d
commit 7a1b273d8d
2 changed files with 8 additions and 15 deletions
+1 -1
View File
@@ -43,7 +43,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
NSString *path = [[(NSArray *)eventPaths objectAtIndex:i] stringByStandardizingPath];
if (useFileBasedListening)
{
{
if (flags & kFSEventStreamEventFlagItemIsFile &&
flags & kFSEventStreamEventFlagItemRemoved)
{
+7 -14
View File
@@ -282,9 +282,9 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
if ([self isPathMatchingIgnoredPaths:fullPath] || ![fm fileExistsAtPath:fullPath])
return;
DLog(@"Parsing modified file: %@", fullPath);
NSArray *arguments = nil;
NSString *successTitle = nil;
NSString *successMsg = nil;
@@ -583,29 +583,24 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
{
if ([ignoredPath length] == 0)
continue;
NSMutableString *regexp = [NSMutableString stringWithFormat:@"%@/%@", [currentProjectURL path], ignoredPath];
[regexp replaceOccurrencesOfString:@"/*/"
withString:@"/*"
options:0
range:NSMakeRange(0, [regexp length])];
NSMutableString *regexp = [ignoredPath mutableCopy];
[regexp replaceOccurrencesOfString:@"/"
withString:@"\\/"
options:0
range:NSMakeRange(0, [regexp length])];
[regexp replaceOccurrencesOfString:@"."
withString:@"\\."
options:0
range:NSMakeRange(0, [regexp length])];
[regexp replaceOccurrencesOfString:@"*"
withString:@".*"
options:0
range:NSMakeRange(0, [regexp length])];
[regexp replaceOccurrencesOfString:@" "
withString:@"\\ "
options:0
@@ -614,11 +609,9 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
NSPredicate *regextest = [NSPredicate predicateWithFormat:@"SELF MATCHES %@", regexp];
if ([regextest evaluateWithObject:aPath])
{
return YES;
}
}
return NO;
}