config_replace - add bool argument

This commit is contained in:
twinaphex 2017-01-24 18:08:26 +01:00
parent e3842d4169
commit 4b476cfe5f
3 changed files with 14 additions and 11 deletions

View File

@ -3353,10 +3353,9 @@ bool config_save_overrides(int override_type)
/* Replaces currently loaded configuration file with /* Replaces currently loaded configuration file with
* another one. Will load a dummy core to flush state * another one. Will load a dummy core to flush state
* properly. */ * properly. */
bool config_replace(char *path) bool config_replace(bool config_save_on_exit, char *path)
{ {
content_ctx_info_t content_info = {0}; content_ctx_info_t content_info = {0};
settings_t *settings = config_get_ptr();
if (!path) if (!path)
return false; return false;
@ -3366,7 +3365,7 @@ bool config_replace(char *path)
if (string_is_equal(path, path_get(RARCH_PATH_CONFIG))) if (string_is_equal(path, path_get(RARCH_PATH_CONFIG)))
return false; 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)); config_save_file(path_get(RARCH_PATH_CONFIG));
path_set(RARCH_PATH_CONFIG, path); path_set(RARCH_PATH_CONFIG, path);

View File

@ -642,7 +642,7 @@ bool config_save_overrides(int override_type);
/* Replaces currently loaded configuration file with /* Replaces currently loaded configuration file with
* another one. Will load a dummy core to flush state * another one. Will load a dummy core to flush state
* properly. */ * properly. */
bool config_replace(char *path); bool config_replace(bool config_save_on_exit, char *path);
bool config_init(void); bool config_init(void);

View File

@ -1088,15 +1088,19 @@ static int generic_action_ok(const char *path,
} }
break; break;
case ACTION_OK_LOAD_CONFIG_FILE: case ACTION_OK_LOAD_CONFIG_FILE:
{
settings_t *settings = config_get_ptr();
flush_type = MENU_SETTINGS; flush_type = MENU_SETTINGS;
menu_display_set_msg_force(true); menu_display_set_msg_force(true);
if (config_replace(action_path)) if (config_replace(settings->config_save_on_exit, action_path))
{ {
bool pending_push = false; bool pending_push = false;
menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push); menu_navigation_ctl(MENU_NAVIGATION_CTL_CLEAR, &pending_push);
ret = -1; ret = -1;
} }
}
break; break;
#ifdef HAVE_SHADER_MANAGER #ifdef HAVE_SHADER_MANAGER
case ACTION_OK_LOAD_PRESET: case ACTION_OK_LOAD_PRESET: