CCFileUtils::sharedFileUtils()->getWritablePath() 默认为
/data/data/prjName/
"Java_org_cocos2dx_lib_Cocos2dxHelper.h" 的 std::string
getFileDirectoryJNI() 方法
通过 jni
调用 org.cocos2dx.lib.Cocos2dxHelper.getCocos2dxWritablePath() 获取
具体"路径str" 在org.cocos2dx.lib.Cocos2dxHelper.init() 中
edit line:70
Cocos2dxHelper.sFileDirectory = pContext.getFilesDir().getAbsolutePath();//设置
to
/**方法用于获取SDCard的状态,如果手机装有SDCard,并且可以进行读写,那么方法返回的状态等于Environment.MEDIA_MOUNTED **/
if(Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED))
{
Cocos2dxHelper.sFileDirectory = Environment.getExternalStorageDirectory()+"/"+applicationInfo.packageName;
}
"Java_org_cocos2dx_lib_Cocos2dxHelper.h"
在 cocos2dx\platform\android\jni
class
"Cocos2dxHelper" 在 cocos2dx\platform\android\java\src
时间: 2024-11-13 22:51:13