summaryrefslogtreecommitdiff
path: root/pkg/osx/IWADController.m
diff options
context:
space:
mode:
authorSimon Howard2011-09-11 23:40:44 +0000
committerSimon Howard2011-09-11 23:40:44 +0000
commitefd15d965dee947a04727bb62f4e2092cf28732f (patch)
tree730d99c1e88d5e3145e552ad69dec52d30026d01 /pkg/osx/IWADController.m
parent4d17ab361e90a75dc6deefd37e6eb2ba0610b386 (diff)
parent11024d8214580d63ca7a9e70a121f5ff542a2fce (diff)
downloadchocolate-doom-efd15d965dee947a04727bb62f4e2092cf28732f.tar.gz
chocolate-doom-efd15d965dee947a04727bb62f4e2092cf28732f.tar.bz2
chocolate-doom-efd15d965dee947a04727bb62f4e2092cf28732f.zip
Merge from raven-branch.
Subversion-branch: /branches/strife-branch Subversion-revision: 2367
Diffstat (limited to 'pkg/osx/IWADController.m')
-rw-r--r--pkg/osx/IWADController.m39
1 files changed, 39 insertions, 0 deletions
diff --git a/pkg/osx/IWADController.m b/pkg/osx/IWADController.m
index 91c02c46..4f3f393f 100644
--- a/pkg/osx/IWADController.m
+++ b/pkg/osx/IWADController.m
@@ -384,5 +384,44 @@ static NSString *IWADFilenames[NUM_IWAD_TYPES + 1] =
//free(env);
}
+// Examine a path to a WAD and determine whether it is an IWAD file.
+// If so, it is added to the IWAD configuration, and true is returned.
+
+- (BOOL) addIWADPath: (NSString *) path
+{
+ IWADLocation *iwadList[NUM_IWAD_TYPES];
+ NSArray *pathComponents;
+ NSString *filename;
+ unsigned int i;
+
+ [self getIWADList: iwadList];
+
+ // Find an IWAD file that matches the filename in the path that we
+ // have been given.
+
+ pathComponents = [path pathComponents];
+ filename = [pathComponents objectAtIndex: [pathComponents count] - 1];
+
+ for (i = 0; i < NUM_IWAD_TYPES; ++i)
+ {
+ if ([filename caseInsensitiveCompare: IWADFilenames[i]] == 0)
+ {
+ // Configure this IWAD.
+
+ [iwadList[i] setLocation: path];
+
+ // Rebuild dropdown list and select the new IWAD.
+
+ [self setDropdownList];
+ [self->iwadSelector selectItemWithTitle:IWADLabels[i]];
+ return YES;
+ }
+ }
+
+ // No IWAD found with this name.
+
+ return NO;
+}
+
@end