Cleanup command_event_save_current_config

This commit is contained in:
twinaphex 2017-01-01 05:36:18 +01:00
parent 92ca53db01
commit fa606ee479
1 changed files with 23 additions and 17 deletions

View File

@ -1591,29 +1591,35 @@ static bool command_event_save_core_config(void)
* Saves current configuration file to disk, and (optionally) * Saves current configuration file to disk, and (optionally)
* autosave state. * autosave state.
**/ **/
static void command_event_save_current_config(int override_type) static void command_event_save_current_config(enum override_type type)
{ {
char msg[128] = {0}; char msg[128] = {0};
if (override_type) switch (type)
{ {
if (config_save_overrides(override_type)) case OVERRIDE_NONE:
{ if (!path_is_empty(RARCH_PATH_CONFIG))
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg)); command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
RARCH_LOG("[overrides] %s\n", msg); break;
case OVERRIDE_GAME:
case OVERRIDE_CORE:
if (config_save_overrides(type))
{
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_SAVED_SUCCESSFULLY), sizeof(msg));
RARCH_LOG("[overrides] %s\n", msg);
/* set overrides to active so the original config can be /* set overrides to active so the original config can be
restored after closing content */ restored after closing content */
runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL); runloop_ctl(RUNLOOP_CTL_SET_OVERRIDES_ACTIVE, NULL);
} }
else else
{ {
strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg)); strlcpy(msg, msg_hash_to_str(MSG_OVERRIDES_ERROR_SAVING), sizeof(msg));
RARCH_ERR("[overrides] %s\n", msg); RARCH_ERR("[overrides] %s\n", msg);
} }
break;
} }
else if (!path_is_empty(RARCH_PATH_CONFIG))
command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
if (!string_is_empty(msg)) if (!string_is_empty(msg))
runloop_msg_queue_push(msg, 1, 180, true); runloop_msg_queue_push(msg, 1, 180, true);