Skip to content

Commit

Permalink
Fix +[CCFileUtils getDoubleResolutionImage:] for Retina
Browse files Browse the repository at this point in the history
When an image and its high-resolution counterpart have different
extensions, this method would not generate a proper abslute path to the
high-resolution image.

We fix this by using an additional call to -[NSBundle
pathForResource:ofType:] when the final path appears to be relative.
  • Loading branch information
alco committed Dec 20, 2011
1 parent 7a4e04b commit c2c4ce0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions cocos2d/Support/CCFileUtils.m
Expand Up @@ -130,6 +130,9 @@ +(NSString*) getDoubleResolutionImage:(NSString*)path
NSString *retinaName = [pathWithoutExtension stringByAppendingString:CC_RETINA_DISPLAY_FILENAME_SUFFIX];
retinaName = [retinaName stringByAppendingPathExtension:extension];

if (![retinaName isAbsolutePath])
retinaName = [[NSBundle mainBundle] pathForResource:retinaName ofType:nil];

if( [__localFileManager fileExistsAtPath:retinaName] )
return retinaName;

Expand Down

0 comments on commit c2c4ce0

Please sign in to comment.