Remove file prompting and drop all the remaining utility communication plumbing.

This commit is contained in:
Paul Chote
2011-07-23 00:49:18 +12:00
parent 9ec229bef7
commit bf6be0424f
11 changed files with 15 additions and 122 deletions

View File

@@ -15,7 +15,6 @@
IBOutlet NSWindow *window;
}
- (void)launchFilePicker:(NSArray *)args;
- (void)launch;
- (BOOL)initMono;
- (BOOL)shouldHideMenubar;

View File

@@ -19,7 +19,6 @@
extern char **environ;
- (void)applicationDidFinishLaunching:(NSNotification *)aNotification
{
NSArray *args = [[NSProcessInfo processInfo] arguments];
gamePath = [[NSUserDefaults standardUserDefaults] stringForKey:@"gamepath"];
// Try and launch the game
@@ -37,36 +36,10 @@ extern char **environ;
[[NSApplication sharedApplication] terminate:self];
}
// Ingame requests for native dialogs
if ([args containsObject:@"--display-filepicker"])
[self launchFilePicker:args];
else
[self launch];
[self launch];
[NSApp terminate: nil];
}
- (void)launchFilePicker:(NSArray *)args
{
[NSApp activateIgnoringOtherApps:YES];
if ([self shouldHideMenubar])
[NSMenu setMenuBarVisible:NO];
NSOpenPanel *op = [NSOpenPanel openPanel];
[op setLevel:CGShieldingWindowLevel()];
[op setAllowsMultipleSelection:NO];
NSUInteger a = [args indexOfObject:@"--display-filepicker"];
if (a != NSNotFound)
[op setTitle:[args objectAtIndex:a+1]];
if ([op runModal] == NSFileHandlingPanelOKButton)
printf("%s\n", [[[op URL] path] UTF8String]);
[NSApp terminate: nil];
}
- (BOOL)shouldHideMenubar
{
NSTask *task = [[[NSTask alloc] init] autorelease];
@@ -113,7 +86,6 @@ extern char **environ;
[self shouldHideMenubar] ? @"--hide-menubar" : @"--no-hide-menubar",
gamePath,
monoPath,
[NSString stringWithFormat:@"UtilityPath=%@", [[NSBundle mainBundle] executablePath]],
nil];
FSRef appRef;
CFURLGetFSRef((CFURLRef)[NSURL URLWithString:[[[NSBundle mainBundle] executablePath] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]], &appRef);

View File

@@ -13,8 +13,11 @@ int main(int argc, char *argv[])
{
/* When launching a mod, the arguments are of the form
* --launch <game dir> <mono path> <utility path> <support dir option> <mod option> */
if (argc >= 6 && strcmp(argv[1], "--launch") == 0)
if (argc > 1 && strcmp(argv[1], "--launch") == 0)
{
if (argc < 5)
exit(1);
/* Change into the game dir */
chdir(argv[3]);
@@ -23,7 +26,6 @@ int main(int argc, char *argv[])
argv[4],
"--debug",
"OpenRA.Game.exe",
argv[5],
NULL
};