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:
@@ -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];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -9,7 +9,7 @@
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
@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
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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];
|
||||
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;
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user