Merge pull request #1954 from fr500/master

Add SD status to info
This commit is contained in:
Twinaphex 2015-07-13 03:19:16 +02:00
commit 313f015fcd
3 changed files with 41 additions and 10 deletions

View File

@ -37,6 +37,13 @@
struct android_app *g_android;
static pthread_key_t thread_key;
char screenshot_dir[PATH_MAX_LENGTH];
char downloads_dir[PATH_MAX_LENGTH];
char apk_path[PATH_MAX_LENGTH];
char sdcard_dir[PATH_MAX_LENGTH];
char app_dir[PATH_MAX_LENGTH];
char ext_dir[PATH_MAX_LENGTH];
static INLINE void android_app_write_cmd(void *data, int8_t cmd)
{
struct android_app *android_app = (struct android_app*)data;
@ -443,14 +450,7 @@ static bool device_is_game_console(const char *name)
return false;
}
static char screenshot_dir[PATH_MAX_LENGTH];
static char downloads_dir[PATH_MAX_LENGTH];
char apk_path[PATH_MAX_LENGTH];
static char sdcard_dir[PATH_MAX_LENGTH];
char app_dir[PATH_MAX_LENGTH];
char ext_dir[PATH_MAX_LENGTH];
static bool test_permissions(const char *path)
bool test_permissions(const char *path)
{
RARCH_LOG("Testing permissions for %s\n",path);
char buf[PATH_MAX_LENGTH];
@ -479,6 +479,7 @@ static void frontend_android_get_environment_settings(int *argc,
jobject obj = NULL;
jstring jstr = NULL;
struct android_app *android_app = (struct android_app*)data;
char buf[PATH_MAX_LENGTH] = {0};
if (!android_app)
return;
@ -823,17 +824,31 @@ static void frontend_android_get_environment_settings(int *argc,
path_mkdir(g_defaults.sram_dir);
fill_pathname_join(g_defaults.savestate_dir,
app_dir, "saves", sizeof(g_defaults.savestate_dir));
app_dir, "states", sizeof(g_defaults.savestate_dir));
path_mkdir(g_defaults.savestate_dir);
fill_pathname_join(g_defaults.system_dir,
app_dir, "saves", sizeof(g_defaults.system_dir));
app_dir, "system", sizeof(g_defaults.system_dir));
path_mkdir(g_defaults.system_dir);
break;
case SDCARD_ROOT_WRITABLE:
default:
break;
}
/* create save and system directories in the internal dir too */
fill_pathname_join(buf,
app_dir, "saves", sizeof(buf));
path_mkdir(buf);
fill_pathname_join(buf,
app_dir, "states", sizeof(buf));
path_mkdir(buf);
fill_pathname_join(buf,
app_dir, "system", sizeof(buf));
path_mkdir(buf);
RARCH_LOG("Default savefile folder: [%s]", g_defaults.sram_dir);
RARCH_LOG("Default savestate folder: [%s]", g_defaults.savestate_dir);
RARCH_LOG("Default system folder: [%s]", g_defaults.system_dir);

View File

@ -29,6 +29,10 @@
#include <rthreads/rthreads.h>
bool test_permissions(const char *path);
char sdcard_dir[PATH_MAX_LENGTH];
struct android_app
{
ANativeActivity* activity;

View File

@ -38,6 +38,10 @@
#include "../git_version.h"
#include "../performance.h"
#ifdef ANDROID
#include "../frontend/drivers/platform_android.h"
#endif
#ifdef HAVE_NETWORKING
extern char *core_buf;
extern size_t core_len;
@ -315,6 +319,14 @@ static int menu_displaylist_parse_system_info(menu_displaylist_info_t *info)
rarch_info_get_capabilities(RARCH_CAPABILITIES_COMPILER, tmp, sizeof(tmp));
menu_list_push(info->list, tmp, "", MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
#ifdef ANDROID
bool perms = test_permissions(sdcard_dir);
snprintf(tmp, sizeof(tmp), "%s: %s", "Internal SD card status", perms ? "read-write" : "read-only");
menu_list_push(info->list, tmp, "",
MENU_SETTINGS_CORE_INFO_NONE, 0, 0);
#endif
{
char cpu_str[PATH_MAX_LENGTH] = {0};