aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorsix <six@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-03-22 00:24:40 +0000
committersix <six@edf5b092-35ff-0310-97b2-ce42778d08ea>2009-03-22 00:24:40 +0000
commit8efd23aa57105475f58b22751b78df696e019c2a (patch)
tree93bb63289f7dbe826e35f210737b63b11ba3a19d
parentf3787af98ccbde93d1839961aa9826c076208136 (diff)
downloadioquake3-aero-8efd23aa57105475f58b22751b78df696e019c2a.tar.gz
ioquake3-aero-8efd23aa57105475f58b22751b78df696e019c2a.zip
Make the frontend check both the current bundle as well as the default install location
0110 git-svn-id: svn://svn.icculus.org/quake3/trunk@1514 edf5b092-35ff-0310-97b2-ce42778d08ea
-rw-r--r--misc/osxfe/ioquake3fe/Controller.m36
-rw-r--r--misc/osxfe/ioquake3fe/ErrorWindow.m3
-rw-r--r--misc/osxfe/ioquake3fe/ErrorWindowController.m3
3 files changed, 20 insertions, 22 deletions
diff --git a/misc/osxfe/ioquake3fe/Controller.m b/misc/osxfe/ioquake3fe/Controller.m
index 6ebde2f..2d2bf45 100644
--- a/misc/osxfe/ioquake3fe/Controller.m
+++ b/misc/osxfe/ioquake3fe/Controller.m
@@ -9,12 +9,12 @@
#import "Controller.h"
#import "ErrorWindow.h"
+#define IOQ3_BUNDLE @"/Applications/ioquake3/ioquake3.app"
#define IOQ3_BIN @"ioquake3.ub"
@implementation Controller
-- (id)init
-{
+- (id)init {
[super init];
quakeData = [[NSMutableData alloc] initWithCapacity:1.0];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(readPipe:) name:NSFileHandleReadCompletionNotification object:nil];
@@ -22,14 +22,16 @@
return self;
}
-- (void)dealloc
-{
+- (void)dealloc {
[[NSNotificationCenter defaultCenter] removeObserver:self];
[super dealloc];
}
-- (IBAction)launch:(id)sender
-{
+- (IBAction)launch:(id)sender {
+ NSString *ioQuake3Path = [[NSBundle mainBundle] pathForAuxiliaryExecutable:IOQ3_BIN];
+ if (!ioQuake3Path)
+ ioQuake3Path = [[NSBundle bundleWithPath:IOQ3_BUNDLE] pathForAuxiliaryExecutable:IOQ3_BIN];
+
NSPipe *pipe = [NSPipe pipe];
quakeOut = [pipe fileHandleForReading];
[quakeOut readInBackgroundAndNotify];
@@ -41,13 +43,12 @@
NSString *args = [argsTextField stringValue];
if ([args length])
[quakeTask setArguments:[args componentsSeparatedByString:@" "]];
- // tiger sucks
- //[quakeTask setArguments:[args componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]];
+// [quakeTask setArguments:[args componentsSeparatedByCharactersInSet:[NSCharacterSet whitespaceCharacterSet]]]; // tiger
BOOL die = NO;
@try {
- [quakeTask setLaunchPath:[[NSBundle mainBundle] pathForAuxiliaryExecutable:IOQ3_BIN]];
+ [quakeTask setLaunchPath:ioQuake3Path];
[quakeTask launch];
}
@catch (NSException *e) {
@@ -56,8 +57,10 @@
defaultButton:NSLocalizedString(@"OK", @"OK")
alternateButton:nil
otherButton:nil
- informativeTextWithFormat:NSLocalizedString(@"Something is probably wrong with the actual ioquake3 binary.", @"launch failed text")]
- runModal];
+// informativeTextWithFormat:NSLocalizedString(@"Something is probably wrong with the actual ioquake3 binary.", @"launch failed text")]
+// informativeTextWithFormat:NSLocalizedString([@"Unable to find the Quake binary at:\n" stringByAppendingString:ioQuake3Path], @"launch failed text")]
+ informativeTextWithFormat:NSLocalizedString([[[e reason] stringByAppendingString:@"\n\nExecutable path was:\n"] stringByAppendingString:ioQuake3Path], @"launch failed text")]
+ runModal];
die = YES;
}
@finally {
@@ -69,8 +72,7 @@
return;
}
-- (void)readPipe:(NSNotification *)note
-{
+- (void)readPipe:(NSNotification *)note {
if ([note object] == quakeOut) {
NSData *outputData = [[note userInfo] objectForKey:NSFileHandleNotificationDataItem];
if ([outputData length])
@@ -80,18 +82,16 @@
}
}
-- (void)taskNote:(NSNotification *)note
-{
+- (void)taskNote:(NSNotification *)note {
if ([note object] == quakeTask) {
if ([quakeTask isRunning] == NO) {
if ([quakeTask terminationStatus] != 0) {
ErrorWindow *ew = [[[ErrorWindow alloc] init] autorelease];
[ew bitch:[[[NSString alloc] initWithData:quakeData encoding:NSUTF8StringEncoding] autorelease]];
- } else {
+ }
+ else
[NSApp terminate:self];
- }
}
}
}
-
@end
diff --git a/misc/osxfe/ioquake3fe/ErrorWindow.m b/misc/osxfe/ioquake3fe/ErrorWindow.m
index bcb373d..93a8d91 100644
--- a/misc/osxfe/ioquake3fe/ErrorWindow.m
+++ b/misc/osxfe/ioquake3fe/ErrorWindow.m
@@ -2,8 +2,7 @@
@implementation ErrorWindow
-- (void)bitch:(NSString *)errorlog
-{
+- (void)bitch:(NSString *)errorlog {
NSLog(errorlog);
NSNib *nib = [[NSNib alloc] initWithNibNamed:@"ErrorWindow.nib" bundle:[NSBundle mainBundle]];
diff --git a/misc/osxfe/ioquake3fe/ErrorWindowController.m b/misc/osxfe/ioquake3fe/ErrorWindowController.m
index 40bd296..ceb3f8b 100644
--- a/misc/osxfe/ioquake3fe/ErrorWindowController.m
+++ b/misc/osxfe/ioquake3fe/ErrorWindowController.m
@@ -12,8 +12,7 @@
// yes, a whole class just so the fucking app will quit
-- (BOOL)windowShouldClose:(id)sender
-{
+- (BOOL)windowShouldClose:(id)sender {
[NSApp terminate:self];
return YES;
}