use getInternalDirectory for getModRuntimeDir on android

This commit is contained in:
matcool 2024-01-20 11:51:29 -03:00
parent b63611ede8
commit 120fa4a1df
2 changed files with 18 additions and 5 deletions
VERSION
loader/src/platform/android

View file

@ -1 +1 @@
2.0.0-beta.2
2.0.0-beta.3

View file

@ -88,10 +88,23 @@ ghc::filesystem::path dirs::getSaveDir() {
}
ghc::filesystem::path dirs::getModRuntimeDir() {
return ghc::filesystem::path(
"/data/user/0/com.geode.launcher/files/geode/unzipped"
);
// return dirs::getGeodeDir() / "unzipped";
static std::string cachedResult = [] {
// incase the jni fails, default to this
std::string path = "/data/user/0/com.geode.launcher/files/";
JniMethodInfo t;
if (JniHelper::getStaticMethodInfo(t, "com/geode/launcher/utils/GeodeUtils", "getInternalDirectory", "()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);
} else {
clearJNIException();
}
return path;
}();
return ghc::filesystem::path(cachedResult) / "geode" / "unzipped";
}
void utils::web::openLinkInBrowser(std::string const& url) {