Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cigumo/2df45bd2199cc4357a0348376fc3ff26 to your computer and use it in GitHub Desktop.
Save cigumo/2df45bd2199cc4357a0348376fc3ff26 to your computer and use it in GitHub Desktop.
[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