From 4b476cfe5fb9029c33a1fb43f09a419e9957456a Mon Sep 17 00:00:00 2001 From: twinaphex Date: Tue, 24 Jan 2017 18:08:26 +0100 Subject: [PATCH] config_replace - add bool argument --- configuration.c | 5 ++--- configuration.h | 2 +- menu/cbs/menu_cbs_ok.c | 18 +++++++++++------- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/configuration.c b/configuration.c index ff573d3ea8..65a6f3fc38 100644 --- a/configuration.c +++ b/configuration.c @@ -3353,10 +3353,9 @@ bool config_save_overrides(int override_type) /* Replaces currently loaded configuration file with * another one. Will load a dummy core to flush state * properly. */ -bool config_replace(char *path) +bool config_replace(bool config_save_on_exit, char *path) { content_ctx_info_t content_info = {0}; - settings_t *settings = config_get_ptr(); if (!path) return false; @@ -3366,7 +3365,7 @@ bool config_replace(char *path) if (string_is_equal(path, path_get(RARCH_PATH_CONFIG))) return false; - if (settings->config_save_on_exit && !path_is_empty(RARCH_PATH_CONFIG)) + if (config_save_on_exit && !path_is_empty(RARCH_PATH_CONFIG)) config_save_file(path_get(RARCH_PATH_CONFIG)); path_set(RARCH_PATH_CONFIG, path); diff --git a/configuration.h b/configuration.h index 24c83373b7..598a42b62c 100644 --- a/configuration.h +++ b/configuration.h @@ -642,7 +642,7 @@ bool config_save_overrides(int override_type); /* Replaces currently loaded configuration file with * another one. Will load a dummy core to flush state * properly. */ -bool config_replace(char *path); +bool config_replace(bool config_save_on_exit, char *path); bool config_init(void); diff --git a/menu/cbs/menu_cbs_ok.c b/menu/cbs/menu_cbs_ok.c index 17649cf3da..765c17e4af 100644 --- a/menu/cbs/menu_cbs_ok.c +++ b/menu/cbs/menu_cbs_ok.c @@ -1088,14 +1088,18 @@ static int generic_action_ok(const char *path, } break; case ACTION_OK_LOAD_CONFIG_FILE: - flush_type = MENU_SETTINGS; - menu_display_set_msg_force(true); - - if (config_replace(action_path)) { - bool pending_push = false; - menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push); - ret = -1; + settings_t *settings = config_get_ptr(); + flush_type = MENU_SETTINGS; + + menu_display_set_msg_force(true); + + if (config_replace(settings->config_save_on_exit, action_path)) + { + bool pending_push = false; + menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push); + ret = -1; + } } break; #ifdef HAVE_SHADER_MANAGER