diff --git a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
index 4e225c2de..e40530853 100644
--- a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
+++ b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
@@ -101,7 +101,7 @@
NSDictionary *taskResult = [self.xcc runTaskWithLaunchPath:launchPath
arguments:arguments
- returnType:kTaskReturnTypeStdError];
+ returnType:kTaskReturnTypeAny];
status = [taskResult[@"status"] intValue];
response = taskResult[@"response"];
@@ -113,11 +113,11 @@
if (status != 0)
{
- if (response.length == 0)
- response = @"An unspecified error occurred";
-
if ([self.xcc isXibFile:self.sourcePath])
{
+ if (response.length == 0)
+ response = @"An unspecified error occurred";
+
notificationTitle = @"Error converting xib";
NSString *message = [NSString stringWithFormat:@"%@\n%@", self.sourcePath.lastPathComponent, response];
@@ -144,20 +144,12 @@
for (NSDictionary *error in errors)
{
- NSMutableDictionary *info = [error mutableCopy];
- info[@"projectId"] = self.projectId;
- info[@"message"] = [NSString stringWithFormat:@"%@, line %d\n%@", [error[@"path"] lastPathComponent], [error[@"line"] intValue], error[@"message"]];
- info[@"status"] = taskResult[@"status"];
-
- if (self.isCancelled)
- return;
-
- [center postNotificationName:XCCConversionDidGenerateErrorNotification object:self userInfo:info];
+ [self postErrorNotificationForPath:error[@"path"] line:[error[@"line"] intValue] message:error[@"message"] status:status];
}
}
@catch (NSException *exception)
{
- DDLogError(@"%@\n%@", exception.reason, response);
+ [self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status];
}
}
@@ -177,6 +169,23 @@
}
}
+- (void)postErrorNotificationForPath:(NSString *)path line:(int)line message:(NSString *)message status:(NSInteger)status
+{
+ NSMutableDictionary *info = [NSMutableDictionary dictionaryWithObjectsAndKeys:
+ path, @"path",
+ [NSNumber numberWithInt:line], @"line",
+ [NSNumber numberWithInteger:status], @"status",
+ nil];
+
+ info[@"projectId"] = self.projectId;
+ info[@"message"] = [NSString stringWithFormat:@"%@, line %d\n%@", [self.sourcePath lastPathComponent], 0, message];
+
+ if (self.isCancelled)
+ return;
+
+ [[NSNotificationCenter defaultCenter] postNotificationName:XCCConversionDidGenerateErrorNotification object:self userInfo:info];
+}
+
- (void)notifyUserWithTitle:(NSString *)title message:(NSString *)message
{
NSDictionary *info = @{ @"projectId":self.projectId, @"title":title, @"message":message };
diff --git a/Tools/XcodeCapp/XcodeCapp/Resources/XcodeCapp help.pages b/Tools/XcodeCapp/XcodeCapp/Resources/XcodeCapp help.pages
index 82f4aff42..73b168d3f 100644
Binary files a/Tools/XcodeCapp/XcodeCapp/Resources/XcodeCapp help.pages and b/Tools/XcodeCapp/XcodeCapp/Resources/XcodeCapp help.pages differ
diff --git a/Tools/XcodeCapp/XcodeCapp/Resources/help.pdf b/Tools/XcodeCapp/XcodeCapp/Resources/help.pdf
index bb4ece531..550ba1d08 100644
Binary files a/Tools/XcodeCapp/XcodeCapp/Resources/help.pdf and b/Tools/XcodeCapp/XcodeCapp/Resources/help.pdf differ
diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
index 6ceb38619..0e7e90c1a 100644
--- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
+++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
@@ -30,7 +30,8 @@ enum XCCAPIMode {
enum XCCTaskReturnType {
kTaskReturnTypeNone,
kTaskReturnTypeStdOut,
- kTaskReturnTypeStdError
+ kTaskReturnTypeStdError,
+ kTaskReturnTypeAny
};
typedef enum XCCTaskReturnType XCCTaskReturnType;
diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m
index 3d826026d..249482620 100644
--- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m
+++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m
@@ -1188,7 +1188,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
@param launchPath The executable to launch
@param arguments NSArray containing the NSTask arguments
- @param returnType Determines whether to return stdout, stderr, or nothing in the response
+ @param returnType Determines whether to return stdout, stderr, either, or nothing in the response
@return NSDictionary containing the return status (NSNumber) and the response (NSString)
*/
- (NSDictionary *)runTaskWithLaunchPath:(NSString *)launchPath arguments:(NSArray *)arguments returnType:(XCCTaskReturnType)returnType
@@ -1211,7 +1211,14 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
DDLogVerbose(@"Task exited: %@:%d", launchPath, task.terminationStatus);
- NSData *data = [[(returnType == kTaskReturnTypeStdOut ? task.standardOutput : task.standardError) fileHandleForReading] availableData];
+ NSData *data = nil;
+
+ if (returnType == kTaskReturnTypeStdOut || returnType == kTaskReturnTypeAny)
+ data = [[task.standardOutput fileHandleForReading] availableData];
+
+ if (returnType == kTaskReturnTypeStdError || (returnType == kTaskReturnTypeAny && [data length] == 0))
+ data = [[task.standardError fileHandleForReading] availableData];
+
NSString *response = [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding];
NSNumber *status = [NSNumber numberWithInt:task.terminationStatus];
diff --git a/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib b/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib
index 9743d0279..b6fe97ddd 100644
--- a/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib
+++ b/Tools/XcodeCapp/XcodeCapp/en.lproj/MainMenu.xib
@@ -326,7 +326,7 @@ dG9pbmUgTWVyY2FkYWwKICAgIGFudG9pbmUubWVyY2FkYWxAZ21haWwuY29tA
{315, 77}