From c2f2fa12a68626a3d2a25231d0aa1c6146d555c3 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Sat, 9 Jan 2010 18:54:04 +0000 Subject: Initial code to identify file type by extension and add file to command line. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1793 --- pkg/osx/AppController.m | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'pkg/osx/AppController.m') diff --git a/pkg/osx/AppController.m b/pkg/osx/AppController.m index bf72af63..03a5965b 100644 --- a/pkg/osx/AppController.m +++ b/pkg/osx/AppController.m @@ -74,10 +74,29 @@ { } -- (BOOL)application:(NSApplication *)application openFile:(NSString *)fileName +- (BOOL) application:(NSApplication *) application + openFile:(NSString *) fileName { - printf("File selected to open: '%s'\n", [fileName UTF8String]); - return NO; + NSString *extension; + + extension = [fileName pathExtension]; + + if (![extension caseInsensitiveCompare: @"wad"]) + { + [self->launcherManager addFileToCommandLine: fileName + forArgument: @"-merge"]; + } + else if (![extension caseInsensitiveCompare: @"deh"]) + { + [self->launcherManager addFileToCommandLine: fileName + forArgument: @"-deh"]; + } + else + { + return NO; + } + + return YES; } - (void)showPrefPanel:(id)sender -- cgit v1.2.3