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 731bdd19fa6312bab67960eb297f8d4aa338964a..ea7c8f9a744742b46fdf179a7d40ac3f5b719506 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 03d9bfd8fc0d8aa91a2e143db48266b775b1118f..ced73a837cff9f80921172c23e6eefa2419bda85 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(),