Fix for nonstandard mono paths.
This commit is contained in:
@@ -21,6 +21,7 @@
|
|||||||
NSMutableArray *httpRequests;
|
NSMutableArray *httpRequests;
|
||||||
NSMutableDictionary *downloads;
|
NSMutableDictionary *downloads;
|
||||||
BOOL hasMono;
|
BOOL hasMono;
|
||||||
|
NSString *monoPath;
|
||||||
|
|
||||||
IBOutlet NSWindow *window;
|
IBOutlet NSWindow *window;
|
||||||
IBOutlet NSOutlineView *outlineView;
|
IBOutlet NSOutlineView *outlineView;
|
||||||
@@ -37,5 +38,5 @@
|
|||||||
- (void)fetchURL:(NSString *)url withCallback:(NSString *)cb;
|
- (void)fetchURL:(NSString *)url withCallback:(NSString *)cb;
|
||||||
- (BOOL)registerDownload:(NSString *)key withURL:(NSString *)url filePath:(NSString *)path;
|
- (BOOL)registerDownload:(NSString *)key withURL:(NSString *)url filePath:(NSString *)path;
|
||||||
- (Download *)downloadWithKey:(NSString *)key;
|
- (Download *)downloadWithKey:(NSString *)key;
|
||||||
- (BOOL)hasSupportedMono;
|
- (BOOL)initMono;
|
||||||
@end
|
@end
|
||||||
|
|||||||
@@ -30,13 +30,16 @@
|
|||||||
{
|
{
|
||||||
NSString *gamePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gamepath"];
|
NSString *gamePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gamepath"];
|
||||||
|
|
||||||
game = [[GameInstall alloc] initWithPath:gamePath];
|
hasMono = [self initMono];
|
||||||
[[JSBridge sharedInstance] setController:self];
|
|
||||||
downloads = [[NSMutableDictionary alloc] init];
|
NSLog(@"%d, %@",hasMono, monoPath);
|
||||||
httpRequests = [[NSMutableArray alloc] init];
|
|
||||||
hasMono = [self hasSupportedMono];
|
|
||||||
if (hasMono)
|
if (hasMono)
|
||||||
{
|
{
|
||||||
|
game = [[GameInstall alloc] initWithGamePath:gamePath monoPath:monoPath];
|
||||||
|
[[JSBridge sharedInstance] setController:self];
|
||||||
|
downloads = [[NSMutableDictionary alloc] init];
|
||||||
|
httpRequests = [[NSMutableArray alloc] init];
|
||||||
|
|
||||||
NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"];
|
NSTableColumn *col = [outlineView tableColumnWithIdentifier:@"mods"];
|
||||||
ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease];
|
ImageAndTextCell *imageAndTextCell = [[[ImageAndTextCell alloc] init] autorelease];
|
||||||
[col setDataCell:imageAndTextCell];
|
[col setDataCell:imageAndTextCell];
|
||||||
@@ -88,15 +91,13 @@
|
|||||||
[[NSApplication sharedApplication] terminate:self];
|
[[NSApplication sharedApplication] terminate:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL)hasSupportedMono
|
- (BOOL)initMono
|
||||||
{
|
{
|
||||||
if (![[NSFileManager defaultManager] fileExistsAtPath:@"/Library/Frameworks/Mono.framework/Commands/mono"])
|
// Find the users mono
|
||||||
return NO;
|
|
||||||
|
|
||||||
NSPipe *outPipe = [NSPipe pipe];
|
NSPipe *outPipe = [NSPipe pipe];
|
||||||
NSTask *task = [[NSTask alloc] init];
|
NSTask *task = [[NSTask alloc] init];
|
||||||
[task setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"];
|
[task setLaunchPath:@"/usr/bin/which"];
|
||||||
[task setArguments:[NSMutableArray arrayWithObject:@"--version"]];
|
[task setArguments:[NSMutableArray arrayWithObject:@"mono"]];
|
||||||
[task setStandardOutput:outPipe];
|
[task setStandardOutput:outPipe];
|
||||||
[task setStandardError:[task standardOutput]];
|
[task setStandardError:[task standardOutput]];
|
||||||
[task launch];
|
[task launch];
|
||||||
@@ -105,6 +106,27 @@
|
|||||||
[task waitUntilExit];
|
[task waitUntilExit];
|
||||||
[task release];
|
[task release];
|
||||||
|
|
||||||
|
NSString *temp = [[[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding] autorelease];
|
||||||
|
// Remove whitespace and resolve symlinks
|
||||||
|
monoPath = [[[temp stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]]
|
||||||
|
stringByResolvingSymlinksInPath] retain];
|
||||||
|
|
||||||
|
if (![monoPath length])
|
||||||
|
return NO;
|
||||||
|
|
||||||
|
// Find the mono version
|
||||||
|
outPipe = [NSPipe pipe];
|
||||||
|
task = [[NSTask alloc] init];
|
||||||
|
[task setLaunchPath:monoPath];
|
||||||
|
[task setArguments:[NSMutableArray arrayWithObject:@"--version"]];
|
||||||
|
[task setStandardOutput:outPipe];
|
||||||
|
[task setStandardError:[task standardOutput]];
|
||||||
|
[task launch];
|
||||||
|
|
||||||
|
data = [[outPipe fileHandleForReading] readDataToEndOfFile];
|
||||||
|
[task waitUntilExit];
|
||||||
|
[task release];
|
||||||
|
|
||||||
NSString *ret = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
NSString *ret = [[NSString alloc] initWithData:data encoding:NSASCIIStringEncoding];
|
||||||
|
|
||||||
int major = 0;
|
int major = 0;
|
||||||
@@ -112,6 +134,7 @@
|
|||||||
int point = 0;
|
int point = 0;
|
||||||
sscanf([ret UTF8String], "Mono JIT compiler version %d.%d.%d", &major, &minor, &point);
|
sscanf([ret UTF8String], "Mono JIT compiler version %d.%d.%d", &major, &minor, &point);
|
||||||
[ret release];
|
[ret release];
|
||||||
|
NSLog(@"mono %d.%d.%d: %@",major,minor,point,monoPath);
|
||||||
|
|
||||||
return (major > 2 ||
|
return (major > 2 ||
|
||||||
(major == 2 && minor > 6) ||
|
(major == 2 && minor > 6) ||
|
||||||
@@ -123,6 +146,7 @@
|
|||||||
[sidebarItems release]; sidebarItems = nil;
|
[sidebarItems release]; sidebarItems = nil;
|
||||||
[downloads release]; downloads = nil;
|
[downloads release]; downloads = nil;
|
||||||
[httpRequests release]; httpRequests = nil;
|
[httpRequests release]; httpRequests = nil;
|
||||||
|
[monoPath release]; monoPath = nil;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,12 +12,12 @@
|
|||||||
@class Controller;
|
@class Controller;
|
||||||
@interface GameInstall : NSObject {
|
@interface GameInstall : NSObject {
|
||||||
NSString *gamePath;
|
NSString *gamePath;
|
||||||
Controller *controller;
|
NSString *monoPath;
|
||||||
NSMutableDictionary *downloadTasks;
|
NSMutableDictionary *downloadTasks;
|
||||||
}
|
}
|
||||||
@property(readonly) NSString *gamePath;
|
@property(readonly) NSString *gamePath;
|
||||||
|
|
||||||
-(id)initWithPath:(NSString *)path;
|
-(id)initWithGamePath:(NSString *)gamepath monoPath:(NSString *)monopath;
|
||||||
-(void)launchMod:(NSString *)mod;
|
-(void)launchMod:(NSString *)mod;
|
||||||
- (NSString *)runUtilityQuery:(NSString *)arg;
|
- (NSString *)runUtilityQuery:(NSString *)arg;
|
||||||
- (NSArray *)installedMods;
|
- (NSArray *)installedMods;
|
||||||
|
|||||||
@@ -13,12 +13,13 @@
|
|||||||
@implementation GameInstall
|
@implementation GameInstall
|
||||||
@synthesize gamePath;
|
@synthesize gamePath;
|
||||||
|
|
||||||
-(id)initWithPath:(NSString *)path
|
-(id)initWithGamePath:(NSString *)gamepath monoPath:(NSString *)monopath
|
||||||
{
|
{
|
||||||
self = [super init];
|
self = [super init];
|
||||||
if (self != nil)
|
if (self != nil)
|
||||||
{
|
{
|
||||||
gamePath = [path retain];
|
gamePath = [gamepath retain];
|
||||||
|
monoPath = [monopath retain];
|
||||||
downloadTasks = [[NSMutableDictionary alloc] init];
|
downloadTasks = [[NSMutableDictionary alloc] init];
|
||||||
}
|
}
|
||||||
return self;
|
return self;
|
||||||
@@ -27,6 +28,7 @@
|
|||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[gamePath release]; gamePath = nil;
|
[gamePath release]; gamePath = nil;
|
||||||
|
[monoPath release]; monoPath = nil;
|
||||||
[downloadTasks release]; downloadTasks = nil;
|
[downloadTasks release]; downloadTasks = nil;
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
@@ -98,7 +100,7 @@
|
|||||||
// First argument is the directory to run in
|
// First argument is the directory to run in
|
||||||
// Second...Nth arguments are passed to OpenRA.Game.exe
|
// Second...Nth arguments are passed to OpenRA.Game.exe
|
||||||
// Launcher wrapper sets mono --debug, gl renderer and support dir.
|
// Launcher wrapper sets mono --debug, gl renderer and support dir.
|
||||||
NSArray *args = [NSArray arrayWithObjects:@"--launch", gamePath,
|
NSArray *args = [NSArray arrayWithObjects:@"--launch", gamePath, monoPath,
|
||||||
[NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]],
|
[NSString stringWithFormat:@"SupportDir=%@",[@"~/Library/Application Support/OpenRA" stringByExpandingTildeInPath]],
|
||||||
[NSString stringWithFormat:@"Game.Mods=%@",mod],
|
[NSString stringWithFormat:@"Game.Mods=%@",mod],
|
||||||
nil];
|
nil];
|
||||||
@@ -132,7 +134,7 @@
|
|||||||
|
|
||||||
NSTask *task = [[NSTask alloc] init];
|
NSTask *task = [[NSTask alloc] init];
|
||||||
[task setCurrentDirectoryPath:gamePath];
|
[task setCurrentDirectoryPath:gamePath];
|
||||||
[task setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"];
|
[task setLaunchPath:monoPath];
|
||||||
[task setArguments:taskArgs];
|
[task setArguments:taskArgs];
|
||||||
[task setStandardOutput:outPipe];
|
[task setStandardOutput:outPipe];
|
||||||
[task setStandardError:[task standardOutput]];
|
[task setStandardError:[task standardOutput]];
|
||||||
@@ -156,7 +158,7 @@
|
|||||||
[taskArgs addObject:arg];
|
[taskArgs addObject:arg];
|
||||||
|
|
||||||
[task setCurrentDirectoryPath:gamePath];
|
[task setCurrentDirectoryPath:gamePath];
|
||||||
[task setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"];
|
[task setLaunchPath:monoPath];
|
||||||
[task setArguments:taskArgs];
|
[task setArguments:taskArgs];
|
||||||
[task setStandardOutput:pipe];
|
[task setStandardOutput:pipe];
|
||||||
|
|
||||||
|
|||||||
Binary file not shown.
@@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
||||||
<plist version="1.0">
|
|
||||||
<dict>
|
|
||||||
<key>CFBundleIdentifier</key>
|
|
||||||
<string>OpenRA</string>
|
|
||||||
<key>CFBundleExecutable</key>
|
|
||||||
<string>OpenRA</string>
|
|
||||||
<key>CFBundleIconFile</key>
|
|
||||||
<string>OpenRA.icns</string>
|
|
||||||
</dict>
|
|
||||||
</plist>
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Copyright 2007-2010 The OpenRA Developers (see AUTHORS)
|
|
||||||
# This file is part of OpenRA, which is free software. It is made
|
|
||||||
# available to you under the terms of the GNU General Public License
|
|
||||||
# as published by the Free Software Foundation. For more information,
|
|
||||||
# see LICENSE.
|
|
||||||
|
|
||||||
export DYLD_LIBRARY_PATH="$1:$DYLD_LIBRARY_PATH"
|
|
||||||
echo "Launching OpenRA from $1"
|
|
||||||
cd $1
|
|
||||||
mono --debug OpenRA.Game.exe SupportDir=~/Library/"Application Support"/OpenRA ${@:2}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
../../../OpenRA.icns
|
|
||||||
Binary file not shown.
Binary file not shown.
@@ -20,11 +20,11 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
/* Command line args for mono */
|
/* Command line args for mono */
|
||||||
char *args[] = {
|
char *args[] = {
|
||||||
"/Library/Frameworks/Mono.framework/Commands/mono",
|
argv[3],
|
||||||
"--debug",
|
"--debug",
|
||||||
"OpenRA.Game.exe",
|
"OpenRA.Game.exe",
|
||||||
argv[3],
|
|
||||||
argv[4],
|
argv[4],
|
||||||
|
argv[5],
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user