Skip to content

Commit

Permalink
Merge pull request #1513 from rkachowski/bugfix/1467
Browse files Browse the repository at this point in the history
Add the project name to spritesheet cache directory.
  • Loading branch information
rkachowski committed Apr 12, 2015
2 parents 8ef18c8 + 2fe3fb2 commit ff5d36c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
12 changes: 8 additions & 4 deletions SpriteBuilder/ccBuilder/CCBDirectoryPublisher.m
Original file line number Diff line number Diff line change
Expand Up @@ -425,7 +425,8 @@ - (void)publishSpriteSheetDir:(NSString *)spriteSheetDir
attributes:nil
error:nil];

NSString *intermediateFileLookupPath = [[_projectSettings.tempSpriteSheetCacheDirectory stringByAppendingPathComponent:subPathWithRes] stringByAppendingPathComponent:INTERMEDIATE_FILE_LOOKUP_NAME];
NSString *intermediateFileLookupPath = [[_projectSettings.tempSpriteSheetCacheDirectory stringByAppendingPathComponent:subPathWithRes]
stringByAppendingPathComponent:INTERMEDIATE_FILE_LOOKUP_NAME];
[_renamedFilesLookup addIntermediateLookupPath:intermediateFileLookupPath];

if ([self spriteSheetExistsAndUpToDate:srcSpriteSheetDate spriteSheetFile:spriteSheetFile subPath:subPathWithRes])
Expand Down Expand Up @@ -474,16 +475,19 @@ - (PublishSpriteSheetOperation *)createSpriteSheetOperation:(NSString *)publishD
packageSettings:_packageSettings
warnings:_warnings
statusProgress:_publishingTaskStatusProgress];

NSString *spriteSheetCacheDir = [_projectSettings.tempSpriteSheetCacheDirectory stringByAppendingPathComponent:subPath];
NSString *resolutionCacheDir = [spriteSheetCacheDir stringByAppendingPathComponent:[NSString stringWithFormat:@"resources-%@", resolution]];

operation.publishDirectory = publishDirectory;
operation.publishedPNGFiles = _publishedPNGFiles;
operation.srcSpriteSheetDate = srcSpriteSheetDate;
operation.resolution = resolution;
operation.srcDirs = @[
[[_projectSettings.tempSpriteSheetCacheDirectory stringByAppendingPathComponent:subPath] stringByAppendingPathComponent:[NSString stringWithFormat:@"resources-%@", resolution]],
[_projectSettings.tempSpriteSheetCacheDirectory stringByAppendingPathComponent:subPath]];
operation.srcDirs = @[resolutionCacheDir, spriteSheetCacheDir];
operation.spriteSheetFile = spriteSheetFile;
operation.subPath = subPath;
operation.osType = _osType;

return operation;
}

Expand Down
5 changes: 4 additions & 1 deletion SpriteBuilder/ccBuilder/ProjectSettings.m
Original file line number Diff line number Diff line change
Expand Up @@ -298,7 +298,10 @@ - (NSString*) displayCacheDirectory
- (NSString*) tempSpriteSheetCacheDirectory
{
NSArray *paths = NSSearchPathForDirectoriesInDomains(NSCachesDirectory, NSUserDomainMask, YES);
return [[paths[0] stringByAppendingPathComponent:PUBLISHER_CACHE_DIRECTORY_NAME] stringByAppendingPathComponent:@"spritesheet"];
NSString *cacheDir = [paths[0] stringByAppendingPathComponent:PUBLISHER_CACHE_DIRECTORY_NAME];
NSString *projectDir = [NSString stringWithFormat:@"%@-spritesheet", [_projectPath lastPathComponent]];

return [cacheDir stringByAppendingPathComponent:projectDir];
}

- (void) _storeDelayed
Expand Down

0 comments on commit ff5d36c

Please sign in to comment.