Issue with CCSpriteFrameCache::addSpriteFramesWithFile(const char*) -> fixed

Hoi cocos2dx heads,

i found a small issue in the addSpriteFramesWithFile method when loading a plist file from the Zwoptex application.
The method tries to read the texture filename from the plist file like this:

CCDictionary<std::string, CCObject*>* metadataDict = (CCDictionary<std::string, CCObject*>*)dict~~>objectForKey);
if
{
texturePath = string);
}
if )
{
// build texture path relative to plist file
texturePath = CCFileUtils::fullPathFromRelativeFile, pszPath);
}
which will result in an empty texturePath string.
The Zwoptex plist metadata is currently structured like this:
metadata

version
1.5.3
format
3
size

name
Untitled
premultipliedAlpha

target

name
default
textureFileName
player_acurate_monks_feet
textureFileExtension
.png
coordinatesFileName
player_acurate_monks_feet
coordinatesFileExtension
.plist
premultipliedAlpha



If we change the code to:
if
{
// try to read texture file name from meta data
CCDictionary<std::string, CCObject*>* targetDict = metadataDict~~>objectForKey(string(“target”));
if (targetDict)
{
texturePath = string(valueForKey(“textureFileName”, targetDict));
std::string textureFileExtension(“”);
textureFileExtension = string(valueForKey(“textureFileExtension”, targetDict));
if (!textureFileExtension.empty())
{
texturePath.append(textureFileExtension);
}
else
{
texturePath.append(“.png”);
}
}
}

it will work.

I don’t know if this also happens with other file formats because i am only using Zwoptex but maybe you can fix this in the next build.
I also know that there is a backup check if a file with the name name exists but a png ending. this is a good workaround but more error prone than reading it directly from the plist. which ususally gets generated together with the png.

Another suggestion:
I think it would be very helpful if the method would return an autoreleased pointer to the metaDataDict. What do you think about this? It would be cool to be able to work immediately with the metadata without to load it again into memory.

Greetings
Markus