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];
jsbridge = [[JSBridge alloc] initWithController:self];
[[webView windowScriptObject] setValue:jsbridge forKey:@"Launcher"];
[[webView windowScriptObject] setValue:jsbridge forKey:@"external"];
}
- (SidebarEntry *)sidebarModsTree

View File

@@ -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]];
}

View File

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

View File

@@ -84,7 +84,7 @@
</div>
</div>
<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" />
</div>
</div>