mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
use jni basedirectory for android paths
This commit is contained in:
parent
198948319b
commit
91c68f525b
1 changed files with 18 additions and 10 deletions
|
@ -44,20 +44,28 @@ CCPoint cocos::getMousePos() {
|
|||
return CCPoint(0, 0);
|
||||
}
|
||||
|
||||
namespace {
|
||||
ghc::filesystem::path getBaseDir() {
|
||||
JniMethodInfo t;
|
||||
std::string path = "/storage/emulated/0/Android/data/com.geode.launcher/files";
|
||||
|
||||
if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "getBaseDirectory", "()Ljava/lang/String;")) {
|
||||
jstring str = reinterpret_cast<jstring>(t.env->CallStaticObjectMethod(t.classID, t.methodID));
|
||||
t.env->DeleteLocalRef(t.classID);
|
||||
path = JniHelper::jstring2string(str);
|
||||
t.env->DeleteLocalRef(str);
|
||||
}
|
||||
|
||||
return ghc::filesystem::path(path);
|
||||
}
|
||||
}
|
||||
|
||||
ghc::filesystem::path dirs::getGameDir() {
|
||||
return ghc::filesystem::path(
|
||||
"/storage/emulated/0/Android/data/com.geode.launcher/files/game"
|
||||
// "/data/user/0/com.geode.launcher/files/"
|
||||
/*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/
|
||||
);
|
||||
return getBaseDir() / "game";
|
||||
}
|
||||
|
||||
ghc::filesystem::path dirs::getSaveDir() {
|
||||
return ghc::filesystem::path(
|
||||
"/storage/emulated/0/Android/data/com.geode.launcher/files/save"
|
||||
// "/data/user/0/com.geode.launcher/files/"
|
||||
/*CCFileUtils::sharedFileUtils()->getWritablePath().c_str()*/
|
||||
);
|
||||
return getBaseDir() / "save";
|
||||
}
|
||||
|
||||
ghc::filesystem::path dirs::getModRuntimeDir() {
|
||||
|
|
Loading…
Reference in a new issue