Use window.external instead of Launcher in js for windows support. Tweak the OpenRA.Utility calls - still doesn't work 100%.

This commit is contained in:
Paul Chote
2010-11-16 19:54:18 +13:00
parent 21e597ca2d
commit 82850cf4fb
4 changed files with 14 additions and 15 deletions

View File

@@ -30,7 +30,7 @@
[outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO]; [outlineView selectRowIndexes:[NSIndexSet indexSetWithIndex:1] byExtendingSelection:NO];
jsbridge = [[JSBridge alloc] initWithController:self]; jsbridge = [[JSBridge alloc] initWithController:self];
[[webView windowScriptObject] setValue:jsbridge forKey:@"Launcher"]; [[webView windowScriptObject] setValue:jsbridge forKey:@"external"];
} }
- (SidebarEntry *)sidebarModsTree - (SidebarEntry *)sidebarModsTree

View File

@@ -110,22 +110,20 @@
- (NSString *)runUtilityQuery:(NSString *)arg - (NSString *)runUtilityQuery:(NSString *)arg
{ {
NSTask *aTask = [[NSTask alloc] init]; NSTask *task = [[NSTask alloc] init];
NSPipe *aPipe = [NSPipe pipe]; NSPipe *outPipe = [NSPipe pipe];
NSFileHandle *readHandle = [aPipe fileHandleForReading];
NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"]; NSMutableArray *taskArgs = [NSMutableArray arrayWithObject:@"OpenRA.Utility.exe"];
[taskArgs addObject:arg]; [taskArgs addObject:arg];
[aTask setCurrentDirectoryPath:[gameURL absoluteString]]; [task setCurrentDirectoryPath:[gameURL absoluteString]];
[aTask setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"]; [task setLaunchPath:@"/Library/Frameworks/Mono.framework/Commands/mono"];
[aTask setArguments:taskArgs]; [task setArguments:taskArgs];
[aTask setStandardOutput:aPipe]; [task setStandardOutput:outPipe];
[aTask setStandardError:[aTask standardOutput]]; [task setStandardError:[task standardOutput]];
[aTask launch]; [task launch];
NSData *data = [readHandle readDataToEndOfFile]; NSData *data = [[outPipe fileHandleForReading] readDataToEndOfFile];
[aTask release]; [task waitUntilExit];
[task release];
return [NSString stringWithUTF8String:[data bytes]]; return [NSString stringWithUTF8String:[data bytes]];
} }

View File

@@ -29,6 +29,7 @@
- (void)launchCurrentMod - (void)launchCurrentMod
{ {
NSLog(@"launchcurrent");
[controller launchGame]; [controller launchGame];
} }

View File

@@ -84,7 +84,7 @@
</div> </div>
</div> </div>
<div id="buttons"> <div id="buttons">
<input type="button" class="button" onclick="Launcher.launchCurrentMod();" value="Play" /> <input type="button" class="button" onclick="window.external.launchCurrentMod();" value="Play" />
<input type="button" class="button" value="Install Music" /> <input type="button" class="button" value="Install Music" />
</div> </div>
</div> </div>