[Commits] SDL: Android: resolve symlinks in SDL_AndroidGetInternalStorageP...

libsdl.org revision control commits-owner at libsdl.org
Wed Jan 10 15:57:10 PST 2018


details:   https://hg.libsdl.org/SDL/rev/56d562cbea17
changeset: 11823:56d562cbea17
user:      Alex Szpakowski <slime73 at gmail.com>
date:      Wed Jan 10 19:56:51 2018 -0400
description:
Android: resolve symlinks in SDL_AndroidGetInternalStoragePath (thanks Henrique Gemignani and cigumo!)

Fixes issues on modern Android versions when the path is used in code that explicitly doesn't follow symlinks (such as PHYSFS_mkdir).

diffstat:

 src/core/android/SDL_android.c |  8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 3f32b61fd611 -r 56d562cbea17 src/core/android/SDL_android.c
--- a/src/core/android/SDL_android.c	Wed Jan 10 10:42:40 2018 -0800
+++ b/src/core/android/SDL_android.c	Wed Jan 10 19:56:51 2018 -0400
@@ -2029,10 +2029,14 @@
             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);


More information about the commits mailing list