diff options
author | Simon Howard | 2010-01-09 18:54:04 +0000 |
---|---|---|
committer | Simon Howard | 2010-01-09 18:54:04 +0000 |
commit | c2f2fa12a68626a3d2a25231d0aa1c6146d555c3 (patch) | |
tree | bac328480cebd7fd4747405c6a986ed8362f8393 /pkg | |
parent | d109ab268f7c7d140bf76d30b4526ef836e070fe (diff) | |
download | chocolate-doom-c2f2fa12a68626a3d2a25231d0aa1c6146d555c3.tar.gz chocolate-doom-c2f2fa12a68626a3d2a25231d0aa1c6146d555c3.tar.bz2 chocolate-doom-c2f2fa12a68626a3d2a25231d0aa1c6146d555c3.zip |
Initial code to identify file type by extension and add file to command
line.
Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1793
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; |