Projects > cpp > Issues > Bug #471

We are migrating issue tracker of Cocos2d-x Project to Github, please create new issue there. Thanks.

Create Issue on Github

invoke CCFileUtils::setResourcePath may cause loading texture for ParticleSystem failed

Bug #471 [Closed] 2011-04-25 23:23 . Updated over 9 years ago

The bug is fisrt reported on android version, by JasonDeng. I reproduce it on win32.

CCParticleSystemQuad* emitter = new CCParticleSystemQuad;
emitter->initWithFile("ptc_texture/huaben_tishi.ptc");  // load xml successfully, but cannot find external texture file

Doing this, huaben_tishi.ptc will be loaded successfully,
then in CCParticleSystem::initWithDictionary, line259, proggram get the textureName = “ptc_texture/huaben_tishi.ptc”, while m_sPlistFile = “../../resource/ptc_texture/huaben_tishi.ptc”
The next line cause this bug

std::string fullpath = CCFileUtils::fulPathFromRelativeFile(textureName, m_sPlistFile.c_str());

As the result, fullpath = “../../resource/../../resource/ptc_texture/ptc_texture/huaben1.png”

The reproducing code is attached. (15.4 kB), 2011-04-25 23:23 2011-04-25 23:30
  • Assignee set to 2011-04-25 23:44
  • Assignee changed from to zhangxm

I traced it more.
0.8.2 version

const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
    std::string relativeFile = fullPathFromRelativePath(pszRelativeFile);
    CCString *pRet = new CCString();
    pRet->m_sString = relativeFile.substr(0, relativeFile.rfind('/')+1);
    pRet->m_sString += pszFilename;
    return pRet->m_sString.c_str();

I modify to

// std::string relativeFile = fullPathFromRelativePath(pszRelativeFile);
std::string relativeFile = pszRelativeFile;

the same to CCFileUtils_android.cpp, the bug can be fixed on win32.

But JasonDeng is using 0.8.2 on android, why the bug is still existing? 2011-04-26 00:03

JasonDeng: CCTextureCache::addImage will add relative path once more, which will cause the error 2011-05-08 06:13
  • Status changed from New to Resolved
  • Assignee changed from zhangxm to

I fixed it on win32 platform. Other platforms seems well. 2011-05-08 06:13
  • Status changed from Resolved to Closed 2012-05-25 08:11
  • Project changed from cocos2d-x to cpp
  • Category deleted (5)
  • Target version deleted (cocos2d-0.99.5-x-0.8.3)
agenindonesia 2014-11-25 20:39 Agen Texas Poker Dan Domino Online Indonesia Terpercaya
OK, I’ve updated the announcement and added a link to zipball on google code. Thank you for reminding me.
Agen Indonesia | Agen Bola | Poker Indonesia

ionliga 2014-11-28 14:45

The optimization introduces a bug where the priority and Touch Mode will not get changed if the list is locked.
The most straight forward fix is to merge the pHandlersToAdd and pHandlersToRemove into a queue and process through all of them in the order they are received Agen Texas Poker dan Domino Online Indonesia Terpercaya | Agen Bola | Taruhan Bola | Agen Bola | Agen Judi Bola Online, Agen Judi Casino Online Indonesia Terpercaya | Jasa SEO | Agen Sbobet

Atom PDF

Start date:2011-04-25
Due date:
% Done:


Target version:-