From 17c100ba4bca1cf8475905b6eeb502e581489c5c Mon Sep 17 00:00:00 2001 From: Holger Schemel Date: Tue, 27 Jun 2017 19:58:55 +0200 Subject: [PATCH] changed using 'external' app data directory on Android version, if possible --- src/init.c | 8 ++++---- src/libgame/setup.c | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/init.c b/src/init.c index 731bdd19..ea7c8f9a 100644 --- a/src/init.c +++ b/src/init.c @@ -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 } diff --git a/src/libgame/setup.c b/src/libgame/setup.c index 03d9bfd8..ced73a83 100644 --- a/src/libgame/setup.c +++ b/src/libgame/setup.c @@ -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(), -- 2.34.1