Skip to content

Commit

Permalink
Support for v4’s filename aliasing by outputting a partial metadata f…
Browse files Browse the repository at this point in the history
…ile along with fileLookup.plist.
  • Loading branch information
slembcke committed Apr 21, 2015
1 parent 59b5d1c commit 15fd1ee
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 1 deletion.
5 changes: 5 additions & 0 deletions SpriteBuilder/ccBuilder/PublishGeneratedFilesOperation.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,11 @@ - (void)generateFileLookup
{
[_warnings addWarningWithDescription:@"Could not write fileLookup.plist."];
}

if (![_fileLookup TEMPwriteMetadataToFileAtomically:[_outputDir stringByAppendingPathComponent:@"metadata.plist"]])
{
[_warnings addWarningWithDescription:@"Could not write metadata.plist."];
}
}

- (NSString *)description
Expand Down
1 change: 1 addition & 0 deletions SpriteBuilder/ccBuilder/PublishRenamedFilesLookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
- (void)addRenamingRuleFrom:(NSString *)src to:(NSString *)dst;

- (BOOL)writeToFileAtomically:(NSString *)filePath;
- (BOOL)TEMPwriteMetadataToFileAtomically:(NSString *)filePath;

- (void)addIntermediateLookupPath:(NSString *)filePath;

Expand Down
14 changes: 14 additions & 0 deletions SpriteBuilder/ccBuilder/PublishRenamedFilesLookup.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,20 @@ - (BOOL)writeToFileAtomically:(NSString *)filePath
return [plist writeToFile:filePath atomically:YES];
}

- (BOOL)TEMPwriteMetadataToFileAtomically:(NSString *)filePath
{
NSMutableDictionary *intermediateLookups = [self loadAndMergeIntermediateLookups];
[_lookup addEntriesFromDictionary:intermediateLookups];

NSMutableDictionary *data = [NSMutableDictionary dictionary];
for(NSString *alias in _lookup){
data[alias] = @{@"filename": _lookup[alias]};
}

NSDictionary *metadata = @{@"data": data};
return [metadata writeToFile:filePath atomically:YES];
}

- (NSMutableDictionary *)loadAndMergeIntermediateLookups
{
NSMutableDictionary *result = [NSMutableDictionary dictionary];
Expand Down
2 changes: 1 addition & 1 deletion SpriteBuilder/libs/cocos2d-iphone

0 comments on commit 15fd1ee

Please sign in to comment.