changed using 'external' app data directory on Android version, if possible
authorHolger Schemel <info@artsoft.org>
Tue, 27 Jun 2017 17:58:55 +0000 (19:58 +0200)
committerHolger Schemel <info@artsoft.org>
Tue, 27 Jun 2017 17:58:55 +0000 (19:58 +0200)
src/init.c
src/libgame/setup.c

index 731bdd1..ea7c8f9 100644 (file)
@@ -6074,10 +6074,10 @@ void OpenAll()
   Error(ERR_DEBUG, "::: SDL_AndroidGetExternalStoragePath() == '%s'",
        SDL_AndroidGetExternalStoragePath());
   Error(ERR_DEBUG, "::: SDL_AndroidGetExternalStorageState() == '%s'",
-       (SDL_AndroidGetExternalStorageState() ==
-        SDL_ANDROID_EXTERNAL_STORAGE_READ ? "read" :
-        SDL_AndroidGetExternalStorageState() ==
-        SDL_ANDROID_EXTERNAL_STORAGE_WRITE ? "write" : "not available"));
+       (SDL_AndroidGetExternalStorageState() &
+        SDL_ANDROID_EXTERNAL_STORAGE_WRITE ? "writable" :
+        SDL_AndroidGetExternalStorageState() &
+        SDL_ANDROID_EXTERNAL_STORAGE_READ ? "readable" : "not available"));
 #endif
 #endif
 }
index 03d9bfd..ced73a8 100644 (file)
@@ -1400,7 +1400,10 @@ char *getUserGameDataDir(void)
 
 #if defined(PLATFORM_ANDROID)
   if (user_game_data_dir == NULL)
-    user_game_data_dir = (char *)SDL_AndroidGetInternalStoragePath();
+    user_game_data_dir = (char *)(SDL_AndroidGetExternalStorageState() &
+                                 SDL_ANDROID_EXTERNAL_STORAGE_WRITE ?
+                                 SDL_AndroidGetExternalStoragePath() :
+                                 SDL_AndroidGetInternalStoragePath());
 #else
   if (user_game_data_dir == NULL)
     user_game_data_dir = getPath2(getPersonalDataDir(),