Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
[PATCH] changes SDL_AndroidGetInternalStoragePath to return a canonical path
diff --git a/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c b/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c
index b93b1625..e11fe3c5 100644
--- a/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c
+++ b/love/src/jni/SDL2-2.0.5/src/core/android/SDL_android.c
@@ -1665,10 +1665,14 @@ const char * SDL_AndroidGetInternalStoragePath()
return NULL;
}
- /* path = fileObject.getAbsolutePath(); */
+ /* path = fileObject.getCanonicalPath(); */
mid = (*env)->GetMethodID(env, (*env)->GetObjectClass(env, fileObject),
- "getAbsolutePath", "()Ljava/lang/String;");
+ "getCanonicalPath", "()Ljava/lang/String;");
pathString = (jstring)(*env)->CallObjectMethod(env, fileObject, mid);
+ if (Android_JNI_ExceptionOccurred(SDL_FALSE)) {
+ LocalReferenceHolder_Cleanup(&refs);
+ return NULL;
+ }
path = (*env)->GetStringUTFChars(env, pathString, NULL);
s_AndroidInternalFilesPath = SDL_strdup(path);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.