Created
March 12, 2012 14:53
-
-
Save talentless/2022448 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
NSString *ccRemoveHDSuffixFromFile( NSString *path ) | |
{ | |
#if CC_IS_RETINA_DISPLAY_SUPPORTED | |
if( CC_CONTENT_SCALE_FACTOR() >= 2 ) { | |
NSString *name = [path lastPathComponent]; | |
// check if path already has the suffix. | |
if( [name rangeOfString:CC_RETINA_IPAD_DISPLAY_FILENAME_SUFFIX].location != NSNotFound ) { | |
CCLOG(@"cocos2d: Filename(%@) contains %@ suffix. Removing it. See cocos2d issue #1040", path, CC_RETINA_IPAD_DISPLAY_FILENAME_SUFFIX); | |
NSString *newLastname = [name stringByReplacingOccurrencesOfString:CC_RETINA_IPAD_DISPLAY_FILENAME_SUFFIX withString:@""]; | |
NSString *pathWithoutLastname = [path stringByDeletingLastPathComponent]; | |
return [pathWithoutLastname stringByAppendingPathComponent:newLastname]; | |
} else if( [name rangeOfString:CC_RETINA_DISPLAY_FILENAME_SUFFIX].location != NSNotFound ) { | |
CCLOG(@"cocos2d: Filename(%@) contains %@ suffix. Removing it. See cocos2d issue #1040", path, CC_RETINA_DISPLAY_FILENAME_SUFFIX); | |
NSString *newLastname = [name stringByReplacingOccurrencesOfString:CC_RETINA_DISPLAY_FILENAME_SUFFIX withString:@""]; | |
NSString *pathWithoutLastname = [path stringByDeletingLastPathComponent]; | |
return [pathWithoutLastname stringByAppendingPathComponent:newLastname]; | |
} | |
} | |
#endif // CC_IS_RETINA_DISPLAY_SUPPORTED | |
return path; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment