- Fixes all logic error
- Add sanity checks
- Drop useless and buggy chunck of code
This commit is contained in:
Antoine Mercadal committed 2011-11-03 22:02:48 +01:00
1 parent fd95c2ced6
commit 9dab10ce19
4 files changed
+36 -36

No files matched your search

+2 -5
View File
@@ -35,18 +35,15 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
{
NSString *path = [(NSArray *)eventPaths objectAtIndex:i];
if (!(eventFlags[i] & 0x00010000)
if (!(eventFlags[i] & kFSEventStreamEventFlagItemIsFile)
|| [xcc isPathMatchingIgnoredPaths:path]
|| (![xcc isXIBFile:path] && ![xcc isObjJFile:path] && ![xcc isXCCIgnoreFile:path]))
continue;
// 0x00000200 should be kFSEventStreamEventFlagItemRemoved but for some reason
// xCode mark this as not recognized.
if (eventFlags[i] & 0x00000200)
if (eventFlags[i] & kFSEventStreamEventFlagItemRemoved)
{
[xcc handleFileRemoval:path];
}
else
{
NSLog(@"this file has been modified or created");
+15 -24
View File
@@ -100,6 +100,7 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
FSEventStreamContext context = {0, appPointer, NULL, NULL, NULL};
NSTimeInterval latency = 2.0;
free(stream);
stream = FSEventStreamCreate(NULL, &fsevents_callback, &context, (CFArrayRef) pathsToWatch,
[lastEventId unsignedLongLongValue], (CFAbsoluteTime) latency, kFSEventStreamCreateFlagUseCFTypes | kFSEventStreamCreateFlagNoDefer | 0x00000010 );
@@ -188,12 +189,12 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
NSLog(@"Starting to parse file modification %@", fullPath);
NSArray *arguments;
NSString *successMsg;
NSNumber *status;
NSString *response;
NSString *errorTitle;
NSString *errorMsg;
NSArray *arguments = nil;
NSString *successMsg = nil;
NSString *response = nil;
NSString *errorTitle = nil;
NSString *errorMsg = nil;
NSNumber *status = [NSNumber numberWithInt:0];
NSString *splitedPath = [NSString stringWithFormat:@"%@/%@", [[fullPath pathComponents] objectAtIndex:[[fullPath pathComponents] count] - 2], [fullPath lastPathComponent]];
NSString *shadowPath = [[self shadowURLForSourceURL:[NSURL URLWithString:[fullPath stringByAddingPercentEscapesUsingEncoding:NSUTF8StringEncoding]]] path];
@@ -222,7 +223,6 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
[self computeIgnoredPaths];
successMsg = @"Ignored files list updated";
arguments = nil;
status = [NSNumber numberWithInt:0];
}
//Run the task and get the response if needed
@@ -245,11 +245,12 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
}
else if (![status intValue] == 0)
{
[errorList addObject:response];
if (response)
[errorList addObject:response];
errorTitle = [NSString stringWithFormat:@"ERROR: %@", splitedPath];
errorMsg = [NSString stringWithFormat:@"Error was: %@.\n\n You may want to check in error list.", response];
[delegate performSelector:@selector(growlWithTitle:message:) withObject:splitedPath withObject:errorMsg];
[delegate performSelector:@selector(growlWithTitle:message:) withObject:errorTitle withObject:errorMsg];
}
[[NSNotificationCenter defaultCenter] postNotificationName:XCCConversionStopNotification object:self];
@@ -362,21 +363,8 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
[NSThread detachNewThreadSelector:@selector(populateXCodeProject:)toTarget:self withObject:nil];
return NO;
}
else
{
NSArray *subdirs = [fm subpathsAtPath:[currentProjectURL path]];
for (NSString *p in subdirs)
{
NSString *path = [NSString stringWithFormat:@"%@/%@", [currentProjectURL path], p];
NSString *shadow = [[self shadowURLForSourceURL:[NSURL URLWithString:path]] path];
if ([self isObjJFile:path] && ![fm fileExistsAtPath:shadow] && ![[path lastPathComponent] isEqualToString:@"main.j"])
{
NSLog(@"File %@ seems to be new. Computing it.", path);
[self handleFileModification:path notify:YES];
}
}
return YES;
}
return YES;
}
/*!
@@ -404,6 +392,9 @@ NSString * const XCCListeningStartNotification = @"XCCListeningStartNotification
*/
- (NSURL*)shadowURLForSourceURL:(NSURL*)aSourceURL
{
if (!aSourceURL)
[NSException raise:NSInvalidArgumentException format:@"shadowURLForSourceURL: aSource URL must not be null"];
NSMutableString *flattenedPath = [NSMutableString stringWithString:[aSourceURL path]];
NSLog(@"Flattened path is : %@", flattenedPath);
[flattenedPath replaceOccurrencesOfString:@"/"
@@ -326,13 +326,13 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
FRAMEWORK_SEARCH_PATHS = "";
GCC_ENABLE_OBJC_GC = supported;
GCC_ENABLE_OBJC_GC = required;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
ONLY_ACTIVE_ARCH = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
SDKROOT = macosx10.7;
};
name = Debug;
};
@@ -342,11 +342,11 @@
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
FRAMEWORK_SEARCH_PATHS = "";
GCC_ENABLE_OBJC_GC = supported;
GCC_ENABLE_OBJC_GC = required;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
PREBINDING = NO;
SDKROOT = macosx10.6;
SDKROOT = macosx10.7;
};
name = Release;
};
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
version = "1.3">
version = "1.8">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
@@ -28,6 +28,15 @@
buildConfiguration = "Debug">
<Testables>
</Testables>
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "027D999913696A7000D3DB13"
BuildableName = "xcodecapp-cocoa.app"
BlueprintName = "xcodecapp-cocoa"
ReferencedContainer = "container:xcodecapp-cocoa.xcodeproj">
</BuildableReference>
</MacroExpansion>
</TestAction>
<LaunchAction
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.GDB"
@@ -36,7 +45,9 @@
displayScale = "1.00"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
buildConfiguration = "Debug">
buildConfiguration = "Debug"
debugDocumentVersioning = "YES"
allowLocationSimulation = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"
@@ -55,7 +66,8 @@
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
buildConfiguration = "Release">
buildConfiguration = "Release"
debugDocumentVersioning = "YES">
<BuildableProductRunnable>
<BuildableReference
BuildableIdentifier = "primary"