Skip to content

Commit

Permalink
Android: resolve symlinks in SDL_AndroidGetInternalStoragePath (thank…
Browse files Browse the repository at this point in the history
…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 3bfada2
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/core/android/SDL_android.c
Expand Up @@ -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);
Expand Down

0 comments on commit 3bfada2

Please sign in to comment.