diff --git a/file_path_special.c b/file_path_special.c index 7f67fd7682..c6902bd622 100644 --- a/file_path_special.c +++ b/file_path_special.c @@ -44,6 +44,7 @@ #include "configuration.h" #include "file_path_special.h" +#include "runloop.h" #include "verbosity.h" void fill_pathname_expand_special(char *out_path, @@ -279,6 +280,18 @@ void fill_pathname_application_special(char *s, size_t len, enum application_spe len); } break; + case APPLICATION_SPECIAL_DIRECTORY_CONFIG: + { + settings_t *settings = config_get_ptr(); + global_t *global = global_get_ptr(); + /* Try config directory setting first, + * fallback to the location of the current configuration file. */ + if (!string_is_empty(settings->directory.menu_config)) + strlcpy(s, settings->directory.menu_config, len); + else if (!string_is_empty(global->path.config)) + fill_pathname_basedir(s, global->path.config, len); + } + break; case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_ICONS: #ifdef HAVE_ZARCH { diff --git a/file_path_special.h b/file_path_special.h index b35c2b6529..3db5fe7feb 100644 --- a/file_path_special.h +++ b/file_path_special.h @@ -26,6 +26,7 @@ enum application_special_type { APPLICATION_SPECIAL_NONE = 0, APPLICATION_SPECIAL_DIRECTORY_AUTOCONFIG, + APPLICATION_SPECIAL_DIRECTORY_CONFIG, APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI, APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_FONT, APPLICATION_SPECIAL_DIRECTORY_ASSETS_MATERIALUI_ICONS, diff --git a/retroarch.c b/retroarch.c index 209c0d96e2..4018d10da1 100644 --- a/retroarch.c +++ b/retroarch.c @@ -51,6 +51,7 @@ #include "dynamic.h" #include "msg_hash.h" #include "movie.h" +#include "file_path_special.h" #include "verbosity.h" #include "frontend/frontend_driver.h" @@ -1195,17 +1196,8 @@ bool retroarch_validate_game_options(char *s, size_t len, bool mkdir) if (string_is_empty(core_name) || string_is_empty(game_name)) return false; - /* Config directory: config_directory. - * Try config directory setting first, - * fallback to the location of the current configuration file. */ - if (!string_is_empty(settings->directory.menu_config)) - strlcpy(config_directory, - settings->directory.menu_config, sizeof(config_directory)); - else if (!string_is_empty(global->path.config)) - fill_pathname_basedir(config_directory, - global->path.config, sizeof(config_directory)); - else - return false; + fill_pathname_application_special(config_directory, sizeof(config_directory), + APPLICATION_SPECIAL_DIRECTORY_CONFIG); /* Concatenate strings into full paths for game_path */ fill_pathname_join(s,