Read/Write settings.ini; use this to select the game to start.
This commit is contained in:
@@ -17,12 +17,28 @@
|
||||
*/
|
||||
|
||||
#import "Controller.h"
|
||||
|
||||
#import "Settings.h"
|
||||
|
||||
@implementation Controller
|
||||
|
||||
- (void)awakeFromNib
|
||||
{
|
||||
NSURL *settingsFile = [NSURL fileURLWithPath:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"launcher.ini"]];
|
||||
settings = [[Settings alloc] init];
|
||||
|
||||
[settings loadSettingsFile:settingsFile];
|
||||
|
||||
modButtonMappings = [[NSDictionary dictionaryWithObjectsAndKeys:
|
||||
@"cnc",@"C&C",
|
||||
@"ra",@"Red Alert",
|
||||
nil] retain];
|
||||
}
|
||||
|
||||
-(IBAction)launchApp:(id)sender
|
||||
{
|
||||
[settings setValue:[modButtonMappings objectForKey:[sender title]] forSetting:@"InitialMods"];
|
||||
[settings save];
|
||||
|
||||
[[NSWorkspace sharedWorkspace] launchApplication:[[[NSBundle mainBundle] resourcePath] stringByAppendingPathComponent:@"OpenRA.app"]];
|
||||
[NSApp terminate: nil];
|
||||
}
|
||||
@@ -140,4 +156,12 @@
|
||||
}
|
||||
}
|
||||
|
||||
- (void) dealloc
|
||||
{
|
||||
[modButtonMappings release];
|
||||
[settings release];
|
||||
[super dealloc];
|
||||
}
|
||||
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user