Skip to content
This repository has been archived by the owner on Jul 24, 2019. It is now read-only.

Fixes a crash on Mohave #26

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 14 additions & 8 deletions cartool/main.m
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ @interface CUICatalog : NSObject

@property(readonly) bool isVectorBased;

-(id)initWithURL:(NSURL *)URL error:(NSError **)error;
-(id)initWithName:(NSString *)n fromBundle:(NSBundle *)b;
-(id)allKeys;
-(id)allImageNames;
Expand Down Expand Up @@ -149,14 +150,19 @@ void exportCarFileAtPath(NSString * carPath, NSString *outputDirectoryPath)
NSError *error = nil;

outputDirectoryPath = [outputDirectoryPath stringByExpandingTildeInPath];

CUIThemeFacet *facet = [CUIThemeFacet themeWithContentsOfURL:[NSURL fileURLWithPath:carPath] error:&error];

CUICatalog *catalog = [[CUICatalog alloc] init];

/* Override CUICatalog to point to a file rather than a bundle */
[catalog setValue:facet forKey:@"_storageRef"];


CUICatalog *catalog = nil;
if ([CUICatalog instancesRespondToSelector:@selector(initWithURL:error:)]) {
/* If CUICatalog has the URL API (Mojave), use it. */
catalog = [[CUICatalog alloc] initWithURL:[NSURL fileURLWithPath:carPath] error:&error];
} else {
CUIThemeFacet *facet = [CUIThemeFacet themeWithContentsOfURL:[NSURL fileURLWithPath:carPath] error:&error];
catalog = [[CUICatalog alloc] init];
/* Override CUICatalog to point to a file rather than a bundle */
[catalog setValue:facet forKey:@"_storageRef"];
}
NSCAssert(!error, @"Error attempting to open asset catalog (%@): %@", carPath, error);

/* CUICommonAssetStorage won't link */
CUICommonAssetStorage *storage = [[NSClassFromString(@"CUICommonAssetStorage") alloc] initWithPath:carPath];

Expand Down