From 4a4c613ee14e4360efe44f0f28ff5ff4cd983c63 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Sat, 17 Sep 2016 16:14:25 +0200 Subject: [PATCH] Start using dir_system functions --- dirs.c | 5 +++++ dirs.h | 2 ++ dynamic.c | 11 +++++++---- runloop.h | 1 - 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/dirs.c b/dirs.c index a42784bc58..89fada36cb 100644 --- a/dirs.c +++ b/dirs.c @@ -81,6 +81,11 @@ char *dir_get_savefile_ptr(void) return dir_savefile; } +char *dir_get_system_ptr(void) +{ + return dir_system; +} + const char *dir_get_system(void) { return dir_system; diff --git a/dirs.h b/dirs.h index 3550f66b44..ef18ff1cfa 100644 --- a/dirs.h +++ b/dirs.h @@ -41,6 +41,8 @@ char *dir_get_savestate_ptr(void); const char *dir_get_savestate(void); +char *dir_get_system_ptr(void); + const char *dir_get_system(void); void dir_set_savefile(const char *path); diff --git a/dynamic.c b/dynamic.c index abd6e37c2d..b82a360c41 100644 --- a/dynamic.c +++ b/dynamic.c @@ -51,6 +51,7 @@ #include "cores/internal_cores.h" #include "frontend/frontend_driver.h" #include "content.h" +#include "dirs.h" #include "paths.h" #include "retroarch.h" #include "runloop.h" @@ -1030,15 +1031,17 @@ bool rarch_environment_cb(unsigned cmd, void *data) if (runloop_ctl(RUNLOOP_CTL_GET_CONTENT_PATH, &fullpath) && fullpath) { + char temp_path[PATH_MAX_LENGTH] = {0}; + RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n", fullpath); - fill_pathname_basedir(global->dir.systemdir, fullpath, - sizeof(global->dir.systemdir)); + fill_pathname_basedir(temp_path, fullpath, sizeof(temp_path)); + dir_set_system(temp_path); } - *(const char**)data = global->dir.systemdir; + *(const char**)data = dir_get_system_ptr(); RARCH_LOG("Environ SYSTEM_DIRECTORY: \"%s\".\n", - global->dir.systemdir); + dir_get_system()); } else { diff --git a/runloop.h b/runloop.h index b33eb8968e..9587b66bd3 100644 --- a/runloop.h +++ b/runloop.h @@ -143,7 +143,6 @@ enum runloop_ctl_state typedef struct rarch_dir { /* Used on reentrancy to use a savestate dir. */ - char systemdir[PATH_MAX_LENGTH]; #ifdef HAVE_OVERLAY char osk_overlay[PATH_MAX_LENGTH]; #endif