Skip to content
Permalink
Browse files

Android: resolve symlinks in SDL_AndroidGetInternalStoragePath (thank…

…s 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).
  • Loading branch information
slime73 committed Jan 10, 2018
1 parent 72d4507 commit 3bfada2e02d002b505788f249ca18f45d323d76a
Showing with 6 additions and 2 deletions.
  1. +6 −2 src/core/android/SDL_android.c
@@ -2029,10 +2029,14 @@ const char * SDL_AndroidGetInternalStoragePath(void)
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);

0 comments on commit 3bfada2

Please sign in to comment.