diff --git a/dynamic.c b/dynamic.c index abbc400a1b..5c5023a39b 100644 --- a/dynamic.c +++ b/dynamic.c @@ -801,10 +801,7 @@ bool rarch_environment_cb(unsigned cmd, void *data) break; case RETRO_ENVIRONMENT_GET_SAVE_DIRECTORY: - *(const char**)data = *current_savefile_dir ? - current_savefile_dir : NULL; - RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n", - current_savefile_dir); + *(const char**)data = rarch_get_current_savefile_dir(); break; case RETRO_ENVIRONMENT_GET_USERNAME: diff --git a/retroarch.c b/retroarch.c index 5e1315b4dc..10d439e57b 100644 --- a/retroarch.c +++ b/retroarch.c @@ -60,13 +60,15 @@ #include "menu/menu_hash.h" #endif -char current_savestate_dir[PATH_MAX_LENGTH]; -char current_savefile_dir[PATH_MAX_LENGTH]; +#include "config.features.h" +static char current_savestate_dir[PATH_MAX_LENGTH]; +static char current_savefile_dir[PATH_MAX_LENGTH]; /* Descriptive names for options without short variant. Please keep the name in sync with the option name. Order does not matter. */ -enum { +enum +{ RA_OPT_MENU = 256, /* must be outside the range of a char */ RA_OPT_PORT, RA_OPT_SPECTATE, @@ -86,9 +88,8 @@ enum { RA_OPT_MAX_FRAMES }; -#include "config.features.h" - #define _PSUPP(var, name, desc) printf(" %s:\n\t\t%s: %s\n", name, desc, _##var##_supp ? "yes" : "no") + static void print_features(void) { puts(""); @@ -323,7 +324,15 @@ static void set_special_paths(char **argv, unsigned num_content) /*fill_pathname_basedir(settings->system_directory, argv[0], sizeof(settings->system_directory));*/ } +} +const char *rarch_get_current_savefile_dir(void) +{ + RARCH_LOG("Environ SAVE_DIRECTORY: \"%s\".\n", + current_savefile_dir); + if (*current_savefile_dir) + return current_savefile_dir; + return NULL; } void set_paths_redirect(const char *path) @@ -336,13 +345,13 @@ void set_paths_redirect(const char *path) (info->info.library_name[0] != '\0')) ? msg_hash_calculate(info->info.library_name) : 0); - /* Initialize current save directories with the values from the config */ - strlcpy(current_savefile_dir, - global->dir.savefile, - sizeof(current_savefile_dir)); - strlcpy(current_savestate_dir, - global->dir.savestate, - sizeof(current_savestate_dir)); + /* Initialize current save directories with the values from the config */ + strlcpy(current_savefile_dir, + global->dir.savefile, + sizeof(current_savefile_dir)); + strlcpy(current_savestate_dir, + global->dir.savestate, + sizeof(current_savestate_dir)); if(global_library_name_hash != 0 #ifdef HAVE_MENU diff --git a/retroarch.h b/retroarch.h index 46e81daae5..07a114993e 100644 --- a/retroarch.h +++ b/retroarch.h @@ -207,9 +207,7 @@ int rarch_info_get_capabilities(enum rarch_capabilities type, char *s, size_t le enum rarch_content_type rarch_path_is_media_type(const char *path); -extern char current_savestate_dir[PATH_MAX_LENGTH]; -extern char current_savefile_dir[PATH_MAX_LENGTH]; -extern bool orig_system_dir_empty; +const char *rarch_get_current_savefile_dir(void); #ifdef __cplusplus }