From 23f91bf8d40386f8a70748f6094401d6e7f4c140 Mon Sep 17 00:00:00 2001 From: twinaphex Date: Thu, 29 Sep 2016 10:07:10 +0200 Subject: [PATCH] Add global conditionals --- paths.c | 64 ++++++++++++++++++++++++++++++++------------------------- 1 file changed, 36 insertions(+), 28 deletions(-) diff --git a/paths.c b/paths.c index 95a1bf2dc2..f3b8054f42 100644 --- a/paths.c +++ b/paths.c @@ -362,22 +362,25 @@ static bool path_init_subsystem(void) } } - /* Let other relevant paths be inferred from the main SRAM location. */ - if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH)) - fill_pathname_noext(global->name.savefile, - path_main_basename, - file_path_str(FILE_PATH_SRM_EXTENSION), - sizeof(global->name.savefile)); - - if (path_is_directory(global->name.savefile)) + if (global) { - fill_pathname_dir(global->name.savefile, - path_main_basename, - file_path_str(FILE_PATH_SRM_EXTENSION), - sizeof(global->name.savefile)); - RARCH_LOG("%s \"%s\".\n", - msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), - global->name.savefile); + /* Let other relevant paths be inferred from the main SRAM location. */ + if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH)) + fill_pathname_noext(global->name.savefile, + path_main_basename, + file_path_str(FILE_PATH_SRM_EXTENSION), + sizeof(global->name.savefile)); + + if (path_is_directory(global->name.savefile)) + { + fill_pathname_dir(global->name.savefile, + path_main_basename, + file_path_str(FILE_PATH_SRM_EXTENSION), + sizeof(global->name.savefile)); + RARCH_LOG("%s \"%s\".\n", + msg_hash_to_str(MSG_REDIRECTING_SAVEFILE_TO), + global->name.savefile); + } } return true; @@ -448,25 +451,30 @@ void path_fill_names(void) global_t *global = global_get_ptr(); path_init_savefile_internal(); - bsv_movie_set_path(global->name.savefile); + + if (global) + bsv_movie_set_path(global->name.savefile); if (string_is_empty(path_main_basename)) return; - if (string_is_empty(global->name.ups)) - fill_pathname_noext(global->name.ups, path_main_basename, - file_path_str(FILE_PATH_UPS_EXTENSION), - sizeof(global->name.ups)); + if (global) + { + if (string_is_empty(global->name.ups)) + fill_pathname_noext(global->name.ups, path_main_basename, + file_path_str(FILE_PATH_UPS_EXTENSION), + sizeof(global->name.ups)); - if (string_is_empty(global->name.bps)) - fill_pathname_noext(global->name.bps, path_main_basename, - file_path_str(FILE_PATH_BPS_EXTENSION), - sizeof(global->name.bps)); + if (string_is_empty(global->name.bps)) + fill_pathname_noext(global->name.bps, path_main_basename, + file_path_str(FILE_PATH_BPS_EXTENSION), + sizeof(global->name.bps)); - if (string_is_empty(global->name.ips)) - fill_pathname_noext(global->name.ips, path_main_basename, - file_path_str(FILE_PATH_IPS_EXTENSION), - sizeof(global->name.ips)); + if (string_is_empty(global->name.ips)) + fill_pathname_noext(global->name.ips, path_main_basename, + file_path_str(FILE_PATH_IPS_EXTENSION), + sizeof(global->name.ips)); + } } /* Core file path */