diff --git a/OpenRA.Launcher.Mac/Controller.m b/OpenRA.Launcher.Mac/Controller.m index af99ae4c82..a9eb226bb8 100644 --- a/OpenRA.Launcher.Mac/Controller.m +++ b/OpenRA.Launcher.Mac/Controller.m @@ -139,7 +139,7 @@ if ([aMod standalone]) { id path = [[game gamePath] stringByAppendingPathComponent:@"mods"]; - id child = [SidebarEntry entryWithMod:aMod allMods:allMods baseURL:[NSURL URLWithString:path]]; + id child = [SidebarEntry entryWithMod:aMod allMods:allMods basePath:path]; [rootItem addChild:child]; } } diff --git a/OpenRA.Launcher.Mac/GameInstall.m b/OpenRA.Launcher.Mac/GameInstall.m index 6a3b7a59c2..fefa8d5522 100644 --- a/OpenRA.Launcher.Mac/GameInstall.m +++ b/OpenRA.Launcher.Mac/GameInstall.m @@ -71,7 +71,7 @@ if (current != nil) { id path = [gamePath stringByAppendingPathComponent:[NSString stringWithFormat:@"mods/%@",current]]; - [ret setObject:[Mod modWithId:current fields:fields baseURL:[NSURL URLWithString:path]] forKey:current]; + [ret setObject:[Mod modWithId:current fields:fields path:path] forKey:current]; } NSLog(@"Parsing mod %@",value); current = value; @@ -85,7 +85,7 @@ if (current != nil) { id path = [gamePath stringByAppendingPathComponent:[NSString stringWithFormat:@"mods/%@",current]]; - [ret setObject:[Mod modWithId:current fields:fields baseURL:[NSURL URLWithString:path]] forKey:current]; + [ret setObject:[Mod modWithId:current fields:fields path:path] forKey:current]; } return ret; diff --git a/OpenRA.Launcher.Mac/JSBridge.m b/OpenRA.Launcher.Mac/JSBridge.m index 3f11600a50..ffe57b9c0f 100644 --- a/OpenRA.Launcher.Mac/JSBridge.m +++ b/OpenRA.Launcher.Mac/JSBridge.m @@ -209,8 +209,7 @@ static JSBridge *SharedInstance; } // Disallow traversing up the directory tree - id path = [[[mod baseURL] absoluteString] - stringByAppendingPathComponent:[aFile stringByReplacingOccurrencesOfString:@"../" + id path = [[mod path] stringByAppendingPathComponent:[aFile stringByReplacingOccurrencesOfString:@"../" withString:@""]]; return [[NSFileManager defaultManager] fileExistsAtPath:path]; diff --git a/OpenRA.Launcher.Mac/Mod.h b/OpenRA.Launcher.Mac/Mod.h index 0383e5e6f8..5c4fb234c8 100644 --- a/OpenRA.Launcher.Mac/Mod.h +++ b/OpenRA.Launcher.Mac/Mod.h @@ -9,7 +9,7 @@ #import @interface Mod : NSObject { - NSURL *baseURL; + NSString *path; NSString *mod; NSString *title; NSString *version; @@ -25,9 +25,9 @@ @property (readonly) NSString *author; @property (readonly) NSString *description; @property (readonly) NSString *requires; -@property (readonly) NSURL *baseURL; +@property (readonly) NSString *path; @property (readonly) BOOL standalone; -+ (id)modWithId:(NSString *)mid fields:(id)fields baseURL:(NSURL *)url; -- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields baseURL:(NSURL *)url; ++ (id)modWithId:(NSString *)mid fields:(id)fields path:(NSString *)path; +- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields path:(NSString *)path; @end diff --git a/OpenRA.Launcher.Mac/Mod.m b/OpenRA.Launcher.Mac/Mod.m index f8d90941e7..4dcced95ac 100644 --- a/OpenRA.Launcher.Mac/Mod.m +++ b/OpenRA.Launcher.Mac/Mod.m @@ -17,22 +17,22 @@ @synthesize description; @synthesize requires; @synthesize standalone; -@synthesize baseURL; +@synthesize path; -+ (id)modWithId:(NSString *)mod fields:(id)fields baseURL:(NSURL *)url ++ (id)modWithId:(NSString *)mod fields:(id)fields path:(NSString *)aPath { - id newObject = [[self alloc] initWithId:mod fields:fields baseURL:url]; + id newObject = [[self alloc] initWithId:mod fields:fields path:aPath]; [newObject autorelease]; return newObject; } -- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields baseURL:(NSURL *)url +- (id)initWithId:(NSString *)anId fields:(NSDictionary *)fields path:(NSString *)aPath { self = [super init]; if (self) { mod = [anId retain]; - baseURL = [url retain]; + path = [aPath retain]; title = [[fields objectForKey:@"Title"] retain]; version = [[fields objectForKey:@"Version"] retain]; author = [[fields objectForKey:@"Author"] retain]; @@ -46,7 +46,7 @@ - (void) dealloc { [mod release]; mod = nil; - [baseURL release]; baseURL = nil; + [path release]; path = nil; [title release]; title = nil; [version release]; version = nil; [author release]; author = nil; diff --git a/OpenRA.Launcher.Mac/SidebarEntry.h b/OpenRA.Launcher.Mac/SidebarEntry.h index 02d0337a00..c40864b72e 100644 --- a/OpenRA.Launcher.Mac/SidebarEntry.h +++ b/OpenRA.Launcher.Mac/SidebarEntry.h @@ -25,7 +25,7 @@ + (id)headerWithTitle:(NSString *)aTitle; + (id)entryWithTitle:(NSString *)aTitle url:(NSURL *)aURL icon:(id)anIcon; -+ (id)entryWithMod:(Mod *)baseMod allMods:(NSDictionary *)allMods baseURL:(NSURL *)aURL; ++ (id)entryWithMod:(Mod *)baseMod allMods:(NSDictionary *)allMods basePath:(NSString *)aPath; - (id)initWithTitle:(NSString *)aTitle url:(NSURL *)aURL icon:(id)anIcon isHeader:(BOOL)aHeader; - (void)addChild:(id)child; - (NSURL *)url; diff --git a/OpenRA.Launcher.Mac/SidebarEntry.m b/OpenRA.Launcher.Mac/SidebarEntry.m index 3d3955007b..2410ecc2c9 100644 --- a/OpenRA.Launcher.Mac/SidebarEntry.m +++ b/OpenRA.Launcher.Mac/SidebarEntry.m @@ -29,14 +29,14 @@ return newObject; } -+ (id)entryWithMod:(Mod *)baseMod allMods:(NSDictionary *)allMods baseURL:(NSURL *)baseURL ++ (id)entryWithMod:(Mod *)baseMod allMods:(NSDictionary *)allMods basePath:(NSString *)basePath { // TODO: Get the mod icon from the Mod // Temporary hack until mods define an icon - NSString* imageName = [[NSBundle mainBundle] pathForResource:@"OpenRA" ofType:@"icns"]; - id icon = [[[NSImage alloc] initWithContentsOfFile:imageName] autorelease]; - id path = [[[baseURL absoluteString] stringByAppendingPathComponent:[baseMod mod]] stringByAppendingPathComponent:@"mod.html"]; - id ret = [SidebarEntry entryWithTitle:[baseMod title] url:[NSURL URLWithString:path] icon:icon]; + NSString *imageName = [[NSBundle mainBundle] pathForResource:@"OpenRA" ofType:@"icns"]; + NSImage *icon = [[[NSImage alloc] initWithContentsOfFile:imageName] autorelease]; + NSURL *url = [NSURL URLWithString:[[[baseMod path] stringByAppendingPathComponent:@"mod.html"] stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]]; + SidebarEntry *ret = [SidebarEntry entryWithTitle:[baseMod title] url:url icon:icon]; for (id key in allMods) { @@ -44,7 +44,7 @@ if (![[aMod requires] isEqualToString:[baseMod mod]]) continue; - id child = [SidebarEntry entryWithMod:aMod allMods:allMods baseURL:baseURL]; + id child = [SidebarEntry entryWithMod:aMod allMods:allMods basePath:basePath]; [ret addChild:child]; } return ret; diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA index aa3641b324..5090cf26d7 100755 Binary files a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA and b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/MacOS/OpenRA differ diff --git a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib index 036262f521..7f736c6f47 100644 Binary files a/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib and b/OpenRA.Launcher.Mac/build/Release/OpenRA.app/Contents/Resources/English.lproj/MainMenu.nib differ