Skip to content
Merged
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions cocos/2d/CCSpriteFrameCache.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,10 @@ void SpriteFrameCache::addSpriteFramesWithFile(const std::string& plist)

// remove .xxx
size_t startPos = texturePath.find_last_of('.');
if(startPos != string::npos)
{
texturePath = texturePath.erase(startPos);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will erase twice?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It will erase twice?

sorry i forgot it, it was fixed in the last commit

texturePath = texturePath.erase(startPos);

// append .png
Expand Down Expand Up @@ -691,8 +695,10 @@ bool SpriteFrameCache::reloadTexture(const std::string& plist)

// remove .xxx
size_t startPos = texturePath.find_last_of('.');
texturePath = texturePath.erase(startPos);

if(startPos != string::npos)
{
texturePath = texturePath.erase(startPos);
}
// append .png
texturePath = texturePath.append(".png");
}
Expand Down