Read/Write settings.ini; use this to select the game to start.

This commit is contained in:
Paul Chote
2010-03-20 00:15:18 +13:00
parent 4a983fb54e
commit e9ba8e2d78
6 changed files with 165 additions and 4 deletions

View File

@@ -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