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);
std::copy(begin_source, end_source, begin_dest);
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 not ok");
pw = fopen("/mnt/sdcard/tileSet3.png","wb");
if( pw )
CCLog("pw not ok");
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
sprintf(str,"FileError: %s", strerror(errno));
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.