From 82850cf4fbd4f9557087bbbe26fb0f988ead5672 Mon Sep 17 00:00:00 2001 From: Paul Chote Date: Tue, 16 Nov 2010 19:54:18 +1300 Subject: [PATCH] Use window.external instead of Launcher in js for windows support. Tweak the OpenRA.Utility calls - still doesn't work 100%. --- OpenRA.Launcher.Mac/Controller.m | 2 +- OpenRA.Launcher.Mac/GameInstall.m | 24 +++++++++++------------- OpenRA.Launcher.Mac/JSBridge.m | 1 + mods/cnc/mod.html | 2 +- 4 files changed, 14 insertions(+), 15 deletions(-) diff --git a/OpenRA.Launcher.Mac/Controller.m b/OpenRA.Launcher.Mac/Controller.m index e86df582b0..58bb8427a0 100644 --- a/OpenRA.Launcher.Mac/Controller.m +++ b/OpenRA.Launcher.Mac/Controller.m @@ -30,7 +30,7 @@ [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO]; jsbridge = [[JSBridge alloc] initWithController:self]; - [[webView windowScriptObject] setValue:jsbridge forKey:@"Launcher"]; + [[webView windowScriptObject] setValue:jsbridge forKey:@"external"]; } - (SidebarEntry *)sidebarModsTree diff --git a/OpenRA.Launcher.Mac/GameInstall.m b/OpenRA.Launcher.Mac/GameInstall.m index f72ed1362f..fc4e33ca1b 100644 --- a/OpenRA.Launcher.Mac/GameInstall.m +++ b/OpenRA.Launcher.Mac/GameInstall.m @@ -110,22 +110,20 @@ - (NSString *)runUtilityQuery:(NSString *)arg { - NSTask *aTask = [[NSTask alloc] init]; - NSPipe *aPipe = [NSPipe pipe]; - NSFileHandle *readHandle = [aPipe fileHandleForReading]; - + NSTask *task = [[NSTask alloc] init]; + NSPipe *outPipe = [NSPipe pipe]; NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"]; [taskArgs addObject:arg]; - [aTask setCurrentDirectoryPath:[gameURL absoluteString]]; - [aTask setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"]; - [aTask setArguments:taskArgs]; - [aTask setStandardOutput:aPipe]; - [aTask setStandardError:[aTask standardOutput]]; - [aTask launch]; - NSData *data = [readHandle readDataToEndOfFile]; - [aTask release]; - + [task setCurrentDirectoryPath:[gameURL absoluteString]]; + [task setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"]; + [task setArguments:taskArgs]; + [task setStandardOutput:outPipe]; + [task setStandardError:[task standardOutput]]; + [task launch]; + NSData *data = [[outPipe fileHandleForReading] readDataToEndOfFile]; + [task waitUntilExit]; + [task release]; return [NSString stringWithUTF8String:[data bytes]]; } diff --git a/OpenRA.Launcher.Mac/JSBridge.m b/OpenRA.Launcher.Mac/JSBridge.m index 3e5802c6b2..bde28e580a 100644 --- a/OpenRA.Launcher.Mac/JSBridge.m +++ b/OpenRA.Launcher.Mac/JSBridge.m @@ -29,6 +29,7 @@ - (void)launchCurrentMod { + NSLog(@"launchcurrent"); [controller launchGame]; } diff --git a/mods/cnc/mod.html b/mods/cnc/mod.html index 6f408c05eb..c9abff0985 100644 --- a/mods/cnc/mod.html +++ b/mods/cnc/mod.html @@ -84,7 +84,7 @@
- +