diff --git a/Tools/XcodeCapp/XcodeCapp/AppController.m b/Tools/XcodeCapp/XcodeCapp/AppController.m
index b7051f78e..764f76479 100644
--- a/Tools/XcodeCapp/XcodeCapp/AppController.m
+++ b/Tools/XcodeCapp/XcodeCapp/AppController.m
@@ -91,9 +91,20 @@ AppController *SharedAppControllerInstance = nil;
if (![self.xcc executablesAreAccessible])
{
- [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
+ [[NSApplication sharedApplication] activateIgnoringOtherApps:YES];
- NSRunAlertPanel(@"Executables are missing.", @"Please make sure that python, jsc, objj and nib2cib (or symlinks to them) are somewhere within one of these directories:\n\n/bin\n/usr/bin\n/usr/local/bin\n/usr/local/narwhal/bin\n~/bin\n\nThen launch XcodeCapp again.", @"Quit", nil, nil);
+ NSRunAlertPanel(
+ @"Executables are missing.",
+ @"Please make sure that each one of these executables:\n\n"
+ @"%@\n\n"
+ @"(or a symlink to it) is within one these directories:\n\n"
+ @"%@\n\n"
+ @"They do not all have to be in the same directory.",
+ @"Quit",
+ nil,
+ nil,
+ [self.xcc.executables componentsJoinedByString:@"\n"],
+ [self.xcc.environmentPaths componentsJoinedByString:@"\n"]);
[[NSApplication sharedApplication] terminate:self];
return;
diff --git a/Tools/XcodeCapp/XcodeCapp/Info.plist b/Tools/XcodeCapp/XcodeCapp/Info.plist
index 384395ab0..3744f29e9 100644
--- a/Tools/XcodeCapp/XcodeCapp/Info.plist
+++ b/Tools/XcodeCapp/XcodeCapp/Info.plist
@@ -17,11 +17,11 @@
CFBundlePackageType
APPL
CFBundleShortVersionString
- 3.0.3
+ 3.0.4
CFBundleSignature
????
CFBundleVersion
- 3.0.3
+ 3.0.4
LSApplicationCategoryType
public.app-category.developer-tools
LSUIElement
@@ -32,12 +32,5 @@
NSApplication
XCCCompatibilityVersion
3
- XCCMandatoryExecutables
-
- python
- narwhal-jsc
- objj
- nib2cib
-
diff --git a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
index df268b11b..4e225c2de 100644
--- a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
+++ b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m
@@ -138,19 +138,26 @@
{
notificationTitle = [(status == XCCStatusCodeError ? @"Error" : @"Warning") stringByAppendingString:@" parsing Objective-J source"];
- NSArray *errors = [response propertyList];
-
- for (NSDictionary *error in errors)
+ @try
{
- 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"];
+ NSArray *errors = [response propertyList];
- if (self.isCancelled)
- return;
-
- [center postNotificationName:XCCConversionDidGenerateErrorNotification object:self userInfo:info];
+ 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];
+ }
+ }
+ @catch (NSException *exception)
+ {
+ DDLogError(@"%@\n%@", exception.reason, response);
}
}
diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
index 373479452..c3044e976 100644
--- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
+++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.h
@@ -57,6 +57,12 @@ extern NSString * const XCCProjectDidFinishLoadingNotification;
*/
@property NSInteger projectId;
+// An array of paths we add to the NSTask environment
+@property NSArray *environmentPaths;
+
+// An array of executable names we need to have available
+@property NSArray *executables;
+
// Full path to .XcodeSupport
@property NSString *supportPath;
diff --git a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m
index f0b194f37..554ce619d 100644
--- a/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m
+++ b/Tools/XcodeCapp/XcodeCapp/XcodeCapp.m
@@ -90,6 +90,7 @@ static NSPredicate * XCCDirectoriesToIgnorePredicate = nil;
// An array of the default predicates used to ignore paths.
static NSArray *XCCDefaultIgnoredPathPredicates = nil;
+
@interface XcodeCapp ()
// Only used with 10.6 when we don't have file-level FSEvents
@@ -175,7 +176,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
@"*/AppKit/",
@"*/Foundation/",
@"*/Objective-J/",
- @"*/*.environment/",
+ @"*/*.environment/",
@"*/Build/",
@"*/*.xcodeproj/",
@"*/.*/",
@@ -240,11 +241,25 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
// Add possible executable paths to PATH
self.environment = [NSProcessInfo processInfo].environment.mutableCopy;
- NSArray *paths = @[@"/usr/local/bin", @"/usr/local/narwhal/bin", @"~/bin".stringByExpandingTildeInPath];
+ self.environmentPaths =
+ @[
+ @"/usr/local/bin",
+ @"/usr/local/narwhal/bin",
+ @"~/narwhal/bin",
+ @"~/bin"
+ ];
+
+ NSMutableArray *paths = [self.environmentPaths mutableCopy];
+
+ for (NSInteger i = 0; i < paths.count; ++i)
+ paths[i] = [paths[i] stringByExpandingTildeInPath];
+
self.environment[@"PATH"] = [[paths componentsJoinedByString:@":"] stringByAppendingFormat:@":%@", self.environment[@"PATH"]];
// Make sure we are using jsc as the narwhal engine!
self.environment[@"NARWHAL_ENGINE"] = @"jsc";
+
+ self.executables = @[@"python", @"narwhal-jsc", @"objj", @"nib2cib"];
}
- (void)initObservers
@@ -1225,9 +1240,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
- (BOOL)executablesAreAccessible
{
- NSArray *executables = [[NSBundle mainBundle] objectForInfoDictionaryKey:XCCMandatoryExecutablesKey];
-
- for (NSString *executable in executables)
+ for (NSString *executable in self.executables)
{
NSDictionary *response = [self runTaskWithLaunchPath:@"/usr/bin/which"
arguments:@[executable]
@@ -1239,7 +1252,7 @@ void fsevents_callback(ConstFSEventStreamRef streamRef,
self.executablePaths[executable] = path;
else
{
- DDLogError(@"Could not find executable '%@' in PATH", executable);
+ DDLogError(@"Could not find executable '%@' in PATH: %@", executable, self.environment[@"PATH"]);
return NO;
}
}