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]
walzer@cocos2d-x.org 2011-04-25 23:23 . Updated about 2 years ago

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

CCFileUtils::setResourcePath("../../resource/");
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.

ParticleLoadTexturePath.zip (15.4 kB) walzer@cocos2d-x.org, 2011-04-25 23:23

walzer@cocos2d-x.org 2011-04-25 23:30
  • Assignee set to walzer@cocos2d-x.org
walzer@cocos2d-x.org 2011-04-25 23:44
  • Assignee changed from walzer@cocos2d-x.org to zhangxm

I traced it more.
0.8.2 version

const char *CCFileUtils::fullPathFromRelativeFile(const char *pszFilename, const char *pszRelativeFile)
{
    _CheckPath();
    std::string relativeFile = fullPathFromRelativePath(pszRelativeFile);
    CCString *pRet = new CCString();
    pRet->autorelease();
    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?

walzer@cocos2d-x.org 2011-04-26 00:03

JasonDeng: CCTextureCache::addImage will add relative path once more, which will cause the error

walzer@cocos2d-x.org 2011-05-08 06:13
  • Status changed from New to Resolved
  • Assignee changed from zhangxm to walzer@cocos2d-x.org

I fixed it on win32 platform. Other platforms seems well.

walzer@cocos2d-x.org 2011-05-08 06:13
  • Status changed from Resolved to Closed
walzer@cocos2d-x.org 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

Pokerstar88.com 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

Pokerstar88.com Agen Texas Poker dan Domino Online Indonesia Terpercaya | Agen Bola | Taruhan Bola | Agen Bola | Olb365.com Agen Judi Bola Online, Agen Judi Casino Online Indonesia Terpercaya | Jasa SEO | Agen Sbobet

Atom PDF

Status:Closed
Start date:2011-04-25
Priority:Normal
Due date:
Assignee:walzer@cocos2d-x.org
% Done:

0%

Category:-
Target version:-

Sign up for our newsletter to keep up with the latest developments, releases and updates for Cocos2d-x.