diff --git a/OpenRA.Launcher.Mac/JSBridge.m b/OpenRA.Launcher.Mac/JSBridge.m index 65c2e92068..3f11600a50 100644 --- a/OpenRA.Launcher.Mac/JSBridge.m +++ b/OpenRA.Launcher.Mac/JSBridge.m @@ -101,8 +101,13 @@ static JSBridge *SharedInstance; - (BOOL)registerDownload:(NSString *)key withURL:(NSString *)url filename:(NSString *)filename { + // Create the download directory if it doesn't exist + NSString *downloadDir = [@"~/Library/Application Support/OpenRA/Downloads/" stringByExpandingTildeInPath]; + if (![[NSFileManager defaultManager] fileExistsAtPath:downloadDir]) + [[NSFileManager defaultManager] createDirectoryAtPath:downloadDir withIntermediateDirectories:YES attributes:nil error:NULL]; + // Disallow traversing directories; take only the last component - id path = [[@"~/Library/Application Support/OpenRA/Downloads/" stringByAppendingPathComponent:[filename lastPathComponent]] stringByExpandingTildeInPath]; + NSString *path = [downloadDir stringByAppendingPathComponent:[filename lastPathComponent]]; return [controller registerDownload:key withURL:url filePath:path]; } 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 0c276157d1..aa3641b324 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