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).
This commit is contained in:
Alex Szpakowski 2018-01-10 19:56:51 -04:00
parent 72d4507918
commit 3bfada2e02
1 changed files with 6 additions and 2 deletions

View File

@ -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);