Hi,
I have a level editor in my game and when ever I edit a level i save the tmx file in sd card and also the tile set image that is used for that level.
To copy the tile set image from assets folder i did this.
@ ifstream source(“tileSet3.png”, ios::binary);
ofstream dest(“/mnt/sdcard/tileSet3.png”, ios::binary);
istreambuf_iterator begin_source(source);
istreambuf_iterator end_source;
ostreambuf_iterator begin_dest(dest);
std::copy(begin_source, end_source, begin_dest);
source.close();
dest.close(); @
this worked on both PC and android and i didnt bothered to check it for long time. I changed tileSet3.png and did some changes in project and when i run this program again on android it stopped working. (still working on PC)
I wanted to check why it’s not working and did this.
pr = fopen("tileSet3.png","rb"); if( pr ) CCLog("pr ok"); else CCLog("pr not ok"); pw = fopen("/mnt/sdcard/tileSet3.png","wb"); if( pw ) CCLog("pw ok"); else CCLog("pw not ok"); while(!feof(pr)){ fread(buf,1,1,pr); fwrite(buf,1,1,pw); } fclose(pr); fclose(pw);
I got “pr not ok, pw ok” in the log.
I tried changing path to “./tileSet3.png” and “/assets/tileSet3.png” but it didnt worked.
I tried to get the exact error by doing this
char str[256]; sprintf(str,"FileError: %s", strerror(errno)); CCLog(str);
This wont even compile in cygwin. it says “‘errno’ was not declared in this scope”. So i cant compile this for android.
So what is the path for assets folder? Is there any function in CCFileUtils that can return the assets folder path?
All the code is working on PC but not in android.
