Handle default config save path differently

This commit is contained in:
sonninnos 2025-06-16 19:14:45 +03:00
parent b490195e0b
commit db5c4d2758
4 changed files with 6 additions and 33 deletions

View File

@ -3368,7 +3368,7 @@ static bool check_menu_driver_compatibility(settings_t *settings)
*
* Returns: handle to config file if found, otherwise NULL.
**/
static config_file_t *open_default_config_file(void)
config_file_t *open_default_config_file(void)
{
char conf_path[PATH_MAX_LENGTH];
config_file_t *conf = NULL;
@ -3528,7 +3528,6 @@ static config_file_t *open_default_config_file(void)
goto error;
path_set(RARCH_PATH_CONFIG, conf_path);
path_set(RARCH_PATH_CONFIG_DEFAULT, conf_path);
return conf;
@ -4009,11 +4008,7 @@ static bool config_load_file(global_t *global,
settings->arrays.midi_output,
DEFAULT_MIDI_OUTPUT);
/* History playlists must stay in default config path */
if (!path_is_empty(RARCH_PATH_CONFIG_DEFAULT))
path_config = path_get(RARCH_PATH_CONFIG_DEFAULT);
else
path_config = path_get(RARCH_PATH_CONFIG);
path_config = path_get(RARCH_PATH_CONFIG);
if (string_is_empty(settings->paths.path_content_favorites))
strlcpy(settings->paths.directory_content_favorites, "default",

View File

@ -24,6 +24,7 @@
#include <boolean.h>
#include <retro_common_api.h>
#include <retro_miscellaneous.h>
#include <file/config_file.h>
#ifdef HAVE_CONFIG_H
#include "config.h"
@ -1316,6 +1317,8 @@ int8_t config_save_overrides(enum override_type type,
* another one. Will load a dummy core to flush state
* properly. */
bool config_replace(bool config_save_on_exit, char *path);
config_file_t *open_default_config_file(void);
#endif
bool config_overlay_enable_default(void);

View File

@ -52,7 +52,6 @@ enum rarch_path_type
RARCH_PATH_CORE_LAST,
RARCH_PATH_CORE_OPTIONS,
RARCH_PATH_CONFIG,
RARCH_PATH_CONFIG_DEFAULT,
RARCH_PATH_CONFIG_APPEND,
RARCH_PATH_CONFIG_OVERRIDE,
RARCH_PATH_DEFAULT_SHADER_PRESET,

View File

@ -2416,10 +2416,6 @@ char *path_get_ptr(enum rarch_path_type type)
if (!path_is_empty(RARCH_PATH_CONFIG))
return p_rarch->path_config_file;
break;
case RARCH_PATH_CONFIG_DEFAULT:
if (!path_is_empty(RARCH_PATH_CONFIG_DEFAULT))
return p_rarch->path_config_default_file;
break;
case RARCH_PATH_CONFIG_APPEND:
if (!path_is_empty(RARCH_PATH_CONFIG_APPEND))
return p_rarch->path_config_append_file;
@ -2458,10 +2454,6 @@ const char *path_get(enum rarch_path_type type)
if (!path_is_empty(RARCH_PATH_CONFIG))
return p_rarch->path_config_file;
break;
case RARCH_PATH_CONFIG_DEFAULT:
if (!path_is_empty(RARCH_PATH_CONFIG_DEFAULT))
return p_rarch->path_config_default_file;
break;
case RARCH_PATH_CONFIG_APPEND:
if (!path_is_empty(RARCH_PATH_CONFIG_APPEND))
return p_rarch->path_config_append_file;
@ -2500,8 +2492,6 @@ size_t path_get_realsize(enum rarch_path_type type)
return sizeof(p_rarch->path_core_options_file);
case RARCH_PATH_CONFIG:
return sizeof(p_rarch->path_config_file);
case RARCH_PATH_CONFIG_DEFAULT:
return sizeof(p_rarch->path_config_default_file);
case RARCH_PATH_CONFIG_APPEND:
return sizeof(p_rarch->path_config_append_file);
case RARCH_PATH_CONFIG_OVERRIDE:
@ -2554,10 +2544,6 @@ bool path_set(enum rarch_path_type type, const char *path)
strlcpy(p_rarch->path_config_file, path,
sizeof(p_rarch->path_config_file));
break;
case RARCH_PATH_CONFIG_DEFAULT:
strlcpy(p_rarch->path_config_default_file, path,
sizeof(p_rarch->path_config_default_file));
break;
case RARCH_PATH_CONFIG_APPEND:
strlcpy(p_rarch->path_config_append_file, path,
sizeof(p_rarch->path_config_append_file));
@ -2605,10 +2591,6 @@ bool path_is_empty(enum rarch_path_type type)
if (string_is_empty(p_rarch->path_config_file))
return true;
break;
case RARCH_PATH_CONFIG_DEFAULT:
if (string_is_empty(p_rarch->path_config_default_file))
return true;
break;
case RARCH_PATH_CONFIG_APPEND:
if (string_is_empty(p_rarch->path_config_append_file))
return true;
@ -2671,9 +2653,6 @@ void path_clear(enum rarch_path_type type)
case RARCH_PATH_CONFIG:
*p_rarch->path_config_file = '\0';
break;
case RARCH_PATH_CONFIG_DEFAULT:
*p_rarch->path_config_default_file = '\0';
break;
case RARCH_PATH_CONFIG_APPEND:
*p_rarch->path_config_append_file = '\0';
break;
@ -2704,7 +2683,6 @@ static void path_clear_all(void)
path_clear(RARCH_PATH_CORE_LAST);
path_clear(RARCH_PATH_CORE_OPTIONS);
path_clear(RARCH_PATH_CONFIG);
path_clear(RARCH_PATH_CONFIG_DEFAULT);
path_clear(RARCH_PATH_CONFIG_APPEND);
path_clear(RARCH_PATH_CONFIG_OVERRIDE);
path_clear(RARCH_PATH_DEFAULT_SHADER_PRESET);
@ -4695,10 +4673,8 @@ bool command_event(enum event_command cmd, void *data)
break;
case CMD_EVENT_MENU_SAVE_MAIN_CONFIG:
{
const char *conf_path = path_get(RARCH_PATH_CONFIG_DEFAULT);
path_set(RARCH_PATH_CONFIG, conf_path);
#ifdef HAVE_CONFIGFILE
open_default_config_file();
command_event_save_current_config(OVERRIDE_NONE);
#endif
}