diff options
Diffstat (limited to 'pkg')
-rw-r--r-- | pkg/osx/AppController.h | 5 | ||||
-rw-r--r-- | pkg/osx/AppController.m | 25 | ||||
-rw-r--r-- | pkg/osx/LauncherManager.h | 3 | ||||
-rw-r--r-- | pkg/osx/LauncherManager.m | 6 |
4 files changed, 34 insertions, 5 deletions
diff --git a/pkg/osx/AppController.h b/pkg/osx/AppController.h index 80f9a461..6714eb2f 100644 --- a/pkg/osx/AppController.h +++ b/pkg/osx/AppController.h @@ -24,11 +24,12 @@ #define LAUNCHER_APPCONTROLLER_H #include <AppKit/AppKit.h> -// Uncomment if your application is Renaissance-based -//#include <Renaissance/Renaissance.h> + +#include "LauncherManager.h" @interface AppController : NSObject { + LauncherManager *launcherManager; } + (void)initialize; 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 diff --git a/pkg/osx/LauncherManager.h b/pkg/osx/LauncherManager.h index 11852dcf..de95265a 100644 --- a/pkg/osx/LauncherManager.h +++ b/pkg/osx/LauncherManager.h @@ -40,6 +40,9 @@ - (void) launch: (id)sender; - (void) runSetup: (id)sender; - (void) awakeFromNib; +- (void) addFileToCommandLine: (NSString *) fileName + forArgument: (NSString *) args; + @end diff --git a/pkg/osx/LauncherManager.m b/pkg/osx/LauncherManager.m index cda7b3e7..ff90b987 100644 --- a/pkg/osx/LauncherManager.m +++ b/pkg/osx/LauncherManager.m @@ -61,6 +61,12 @@ } } +- (void) addFileToCommandLine: (NSString *) fileName + forArgument: (NSString *) args +{ + // TODO +} + - (void) launch: (id)sender { NSString *iwad; |