mirror of
https://github.com/love2d/love-android.git
synced 2026-08-19 12:14:49 +02:00
Now, we have a filetype association!!!! :)
This commit is contained in:
@@ -52,6 +52,30 @@ double getScreenScale()
|
||||
return result;
|
||||
}
|
||||
|
||||
const char* getSelectedGameFile()
|
||||
{
|
||||
static const char *path;
|
||||
|
||||
if (!path) {
|
||||
JNIEnv *env = (JNIEnv*) SDL_AndroidGetJNIEnv();
|
||||
jclass activity = env->FindClass("org/love2d/android/GameLauncher");
|
||||
|
||||
jmethodID getGamePath = env->GetStaticMethodID(activity, "getGamePath", "()Ljava/lang/String;");
|
||||
jstring gamePath = (jstring) env->CallStaticObjectMethod(activity, getGamePath);
|
||||
const char *utf = env->GetStringUTFChars(gamePath, 0);
|
||||
if (utf)
|
||||
{
|
||||
path = SDL_strdup(utf);
|
||||
env->ReleaseStringUTFChars(gamePath, utf);
|
||||
}
|
||||
|
||||
env->DeleteLocalRef (gamePath);
|
||||
env->DeleteLocalRef (activity);
|
||||
}
|
||||
|
||||
return path;
|
||||
}
|
||||
|
||||
} // android
|
||||
} // love
|
||||
|
||||
|
||||
@@ -36,6 +36,11 @@ namespace android
|
||||
**/
|
||||
double getScreenScale();
|
||||
|
||||
/**
|
||||
* Gets the selected love file in the device filesystem.
|
||||
**/
|
||||
const char* getSelectedGameFile();
|
||||
|
||||
} // android
|
||||
} // love
|
||||
|
||||
|
||||
Reference in New Issue
Block a user