[bug] unnecessary path prepend in CCFileUtils::getFileData

I am using CCTextureCache::sharedTextureCache()->addPVRImage(“/data/data/com.mycompany/a_texture_file”);
but CCFileUtils::getFileData prepends “assets/”
so the path become “assets//data/data/com.mycompany/a_texture_file”

It works in iOS, but not in android.

Thanks for your feedback!
In the situation you described, you want to read a texture file which is not in assets directory.

Sorry that the methods in the engine only support read resource files in the assets directory of the apk file.
And the parameter of the function CCTextureCache::addPVRImage() should be the relative path of assets directory.

If you want read resource files in the system folders but not in the apk file, you must use fopen/fclose to implement that!
Or if you have much better ideas, welcome to share with us!

Hi Bin Zhang,

I try load texture by fopen…. look this:

FILE * pFile;
long lSize;
char * buffer;
size_t result;

pFile = fopen ( “/mnt/sdcard/mms/test.png” , “rb” );
fseek (pFile , 0 , SEEK_END);
lSize = ftell (pFile);
rewind (pFile);
buffer = (char*) malloc (sizeof(char)lSize);
if
// copy the file into the buffer:
result = fread ;
CCImage image = new CCImage;
image.initWithImageDatabuffer, nSize, CCImage::kFmtPng);
CCTexture2D
texture = new CCTexture2D();
//texture~~>initWithImage;
CCSprite *sprite = new CCSprite;
sprite~~>initWithTexture(texture);

But, if i add sprite into layer, he dont appear…… I can solve this problem??? do you help me please?

I think you should set the texture rect by CCSprite::setTextureRect().