But it returns me wrong directory.
It just gives me in android /data/data/my.packet
What i need is something like, /storage/sdcard0/Android/data/data/my.packet
Should i use fullPathFromRelativePath ?
I looked it too, it does not extend my path ,returns directly same path.
You should use this path directly for that but this won’t be platform-independant (e.g. won’t work at iOS). fullPathFromRelativePath is cross-platform for reading assets, getWritablePath is cross-platform for game progress data. There’s no cross-platform way to get to custom location.
BTW would be nice if cocos2d-x had some kind of getPathWhereICanDropBigDataPackageForMyGameDownloadedFromTheInternetz().
You should use this path directly for that but this won’t be platform-independant (e.g. won’t work at iOS). fullPathFromRelativePath is cross-platform for reading assets, getWritablePath is cross-platform for game progress data. There’s no cross-platform way to get to custom location.
>
BTW would be nice if cocos2d-x had some kind of getPathWhereICanDropBigDataPackageForMyGameDownloadedFromTheInternetz().
Yep,I used the CCFileUtils recently, it seems cannot get a folder that doesn’t exist.
BTW the problem “But fp always return null” ,did you call this function in another thread?
Igor Zavorotkin wrote:
> You should use this path directly for that but this won’t be platform-independant (e.g. won’t work at iOS). fullPathFromRelativePath is cross-platform for reading assets, getWritablePath is cross-platform for game progress data. There’s no cross-platform way to get to custom location.
>
> BTW would be nice if cocos2d-x had some kind of getPathWhereICanDropBigDataPackageForMyGameDownloadedFromTheInternetz().
>
>
Yep,I used the CCFileUtils recently, it seems cannot get a folder that doesn’t exist.
BTW the problem “But fp always return null” ,did you call this function in another thread?
I solved that fp problem by not programming it by C way but i did it with c++ way (ofstream etc.).
You say that you use CCFileUtils recently, is there a better way to reach my data without dependency to platforms?
@Igor i did not get what you exactly said.
My problem is, i have never tried in ios but in android i am not able to get a real absolute writeable path. I just get relative even i use fullPathFromRelativePath.
My app just works on my cellphone because everybody has a different directory as i mentioned /storage/sdcard0/Android/data/data/my.packet (this is what i get)
CCFileUtils is about converting relative paths to absolute paths, it contains application-specific and platform-specific logic for doing that. If you have absolute path already you don’t need to use CCFileUtils. You can read from there if you know it’s readable and write to there if you know it’s writeable.