Image resource path issue

Hi all! I’m very new to Cocos2d-x, currently using the 3.0 alpha (currently testing on OSX and Xcode), and I’m having some resource path issues. since I need direct access to raw pixel data, I decided to use an Image object instead of using the Spite + glReadPixels method. Basically, I’m creating my image like this:

_mapFile = new Image();
bool success = _mapFile->initWithImageFile("G5x5L01.PNG");

This fails because, apparently, Cocos2d can’t find the file. The actual file is located in Resources/levels/G5x5L01.PNG. If I create a Sprite, it gets created successfully, so it seems that there’s something specific to initWithImageFile that I’m missing.
I also tried to add all my searchPaths using FileUtils::getInstance()->setSearchPaths(); but doesn’t seem to fix anything. Am I missing something? Shouldn’t both methods look for the file in the same places?

bool CCImage::initWithImageFile(const char * strPath, EImageFormat eImgFmt/* = eFmtPng*/)
{
    bool bRet = false;
    unsigned long nSize = 0;
    unsigned char* pBuffer = CCFileUtils::sharedFileUtils()->getFileData(
                CCFileUtils::sharedFileUtils()->fullPathForFilename(strPath).c_str(),
                "rb",
                &nSize);

    if (pBuffer != NULL && nSize > 0)
    {
        bRet = initWithImageData(pBuffer, nSize, eImgFmt);
    }
    CC_SAFE_DELETE_ARRAY(pBuffer);
    return bRet;
}

_mapFile = new CCImage(); (Since I can't find the class Image?:( )

HI, thanks for your reply. You probably can’t find cocos2d::Image because you’re using Cocos2D-x version 2 or lower. AFAIK, for 3.0 they decided to ditch the CC prefix and move everything into a namespace. I’m not actually writing cocos2d:: because I have a using call in my source.

And the 3.0 implementation of initWithImageFile() is kinda different to the one you posted, so it seems I’ll have to debug it my self and see where it fails.

Thanks!