Fix osx launcher crash when there is a space in the launcher path. Launching the game still doesn't work in this case.

This commit is contained in:
Paul Chote
2010-12-22 20:35:43 +13:00
parent 54c49dfa15
commit 7ef884532d
9 changed files with 21 additions and 22 deletions

View File

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