Update path_get

This commit is contained in:
twinaphex 2016-09-29 08:31:41 +02:00
parent 1385f2c4fa
commit 329f6ad612
9 changed files with 33 additions and 43 deletions

View File

@ -1453,14 +1453,14 @@ static bool command_event_save_config(const char *config_path,
{
snprintf(s, len, "%s \"%s\".",
msg_hash_to_str(MSG_SAVED_NEW_CONFIG_TO),
path_get_config());
path_get(RARCH_PATH_CONFIG));
RARCH_LOG("%s\n", s);
return true;
}
snprintf(s, len, "%s \"%s\".",
msg_hash_to_str(MSG_FAILED_SAVING_CONFIG_TO),
path_get_config());
path_get(RARCH_PATH_CONFIG));
RARCH_ERR("%s\n", s);
return false;
@ -1489,7 +1489,7 @@ static bool command_event_save_core_config(void)
strlcpy(config_dir, settings->directory.menu_config,
sizeof(config_dir));
else if (!path_is_config_empty()) /* Fallback */
fill_pathname_basedir(config_dir, path_get_config(),
fill_pathname_basedir(config_dir, path_get(RARCH_PATH_CONFIG),
sizeof(config_dir));
else
{
@ -1595,7 +1595,7 @@ static void command_event_save_current_config(int override_type)
}
}
else if (!path_is_config_empty())
command_event_save_config(path_get_config(), msg, sizeof(msg));
command_event_save_config(path_get(RARCH_PATH_CONFIG), msg, sizeof(msg));
if (!string_is_empty(msg))
runloop_msg_queue_push(msg, 1, 180, true);

View File

@ -1723,7 +1723,7 @@ static bool config_load_file(const char *path, bool set_defaults,
char tmp_append_path[PATH_MAX_LENGTH] = {0};
const char *extra_path = NULL;
strlcpy(tmp_append_path, path_get_config_append(),
strlcpy(tmp_append_path, path_get(RARCH_PATH_CONFIG_APPEND),
sizeof(tmp_append_path));
extra_path = strtok_r(tmp_append_path, "|", &save);
@ -1966,7 +1966,7 @@ static bool config_load_file(const char *path, bool set_defaults,
{
fill_pathname_resolve_relative(
settings->path.content_history,
path_get_config(),
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_HISTORY),
sizeof(settings->path.content_history));
}
@ -1985,7 +1985,7 @@ static bool config_load_file(const char *path, bool set_defaults,
{
fill_pathname_resolve_relative(
settings->path.content_music_history,
path_get_config(),
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_MUSIC_HISTORY),
sizeof(settings->path.content_music_history));
}
@ -2004,7 +2004,7 @@ static bool config_load_file(const char *path, bool set_defaults,
{
fill_pathname_resolve_relative(
settings->path.content_video_history,
path_get_config(),
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_VIDEO_HISTORY),
sizeof(settings->path.content_video_history));
}
@ -2023,7 +2023,7 @@ static bool config_load_file(const char *path, bool set_defaults,
{
fill_pathname_resolve_relative(
settings->path.content_image_history,
path_get_config(),
path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CONTENT_IMAGE_HISTORY),
sizeof(settings->path.content_image_history));
}
@ -2255,7 +2255,7 @@ bool config_load_override(void)
if (should_append)
{
strlcpy(temp_path, path_get_config_append(), sizeof(temp_path));
strlcpy(temp_path, path_get(RARCH_PATH_CONFIG_APPEND), sizeof(temp_path));
strlcat(temp_path, "|", sizeof(temp_path));
strlcat(temp_path, game_path, sizeof(temp_path));
}
@ -2289,7 +2289,7 @@ bool config_load_override(void)
retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_STATE_PATH);
retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_SAVE_PATH);
if (!config_load_file(path_get_config(), false, config_get_ptr()))
if (!config_load_file(path_get(RARCH_PATH_CONFIG), false, config_get_ptr()))
return false;
/* Restore the libretro_path we're using
@ -2322,7 +2322,7 @@ bool config_unload_override(void)
retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_STATE_PATH);
retroarch_override_setting_unset(RARCH_OVERRIDE_SETTING_SAVE_PATH);
if (config_load_file(path_get_config(), false, config_get_ptr()))
if (config_load_file(path_get(RARCH_PATH_CONFIG), false, config_get_ptr()))
{
RARCH_LOG("[overrides] configuration overrides unloaded, original configuration restored.\n");
@ -2575,19 +2575,19 @@ static void parse_config_file(void)
{
if (!path_is_config_empty())
{
RARCH_LOG("Config: loading config from: %s.\n", path_get_config());
RARCH_LOG("Config: loading config from: %s.\n", path_get(RARCH_PATH_CONFIG));
}
else
{
RARCH_LOG("Loading default config.\n");
if (!path_is_config_empty())
RARCH_LOG("Config: found default config: %s.\n", path_get_config());
RARCH_LOG("Config: found default config: %s.\n", path_get(RARCH_PATH_CONFIG));
}
if (config_load_file(path_get_config(), false, config_get_ptr()))
if (config_load_file(path_get(RARCH_PATH_CONFIG), false, config_get_ptr()))
return;
RARCH_ERR("Config: couldn't find config at path: \"%s\"\n", path_get_config());
RARCH_ERR("Config: couldn't find config at path: \"%s\"\n", path_get(RARCH_PATH_CONFIG));
}
@ -3118,7 +3118,7 @@ bool config_save_overrides(int override_type)
conf = config_file_new(NULL);
/* Load the original config file in memory */
config_load_file(path_get_config(), false, settings);
config_load_file(path_get(RARCH_PATH_CONFIG), false, settings);
bool_settings_size = populate_settings_bool(settings, &bool_settings);
populate_settings_bool (overrides, &bool_overrides);
@ -3257,11 +3257,11 @@ bool config_replace(char *path)
/* If config file to be replaced is the same as the
* current config file, exit. */
if (string_is_equal(path, path_get_config()))
if (string_is_equal(path, path_get(RARCH_PATH_CONFIG)))
return false;
if (settings->config_save_on_exit && !path_is_config_empty())
config_save_file(path_get_config());
config_save_file(path_get(RARCH_PATH_CONFIG));
path_set(RARCH_PATH_CONFIG, path);

View File

@ -291,7 +291,7 @@ void fill_pathname_application_special(char *s, size_t len, enum application_spe
if (!string_is_empty(settings->directory.menu_config))
strlcpy(s, settings->directory.menu_config, len);
else if (!path_is_config_empty())
fill_pathname_basedir(s, path_get_config(), len);
fill_pathname_basedir(s, path_get(RARCH_PATH_CONFIG), len);
}
break;
case APPLICATION_SPECIAL_DIRECTORY_ASSETS_ZARCH_ICONS:

View File

@ -131,7 +131,7 @@ static void menu_action_setting_disp_set_label_configurations(
strlcpy(s2, path, len2);
if (!path_is_config_empty())
fill_pathname_base(s, path_get_config(),
fill_pathname_base(s, path_get(RARCH_PATH_CONFIG),
len);
else
strlcpy(s, msg_hash_to_str(MENU_ENUM_LABEL_VALUE_DIRECTORY_DEFAULT), len);

View File

@ -53,7 +53,7 @@ void menu_shader_manager_init(void)
struct video_shader *shader = NULL;
config_file_t *conf = NULL;
settings_t *settings = config_get_ptr();
const char *config_path = path_get_config();
const char *config_path = path_get(RARCH_PATH_CONFIG);
menu_driver_ctl(RARCH_MENU_CTL_SHADER_GET,
&shader);
@ -298,7 +298,7 @@ bool menu_shader_manager_save_preset(
if (!path_is_config_empty())
fill_pathname_basedir(
config_directory,
path_get_config(),
path_get(RARCH_PATH_CONFIG),
sizeof(config_directory));
if (!fullpath)

22
paths.c
View File

@ -484,6 +484,14 @@ const char *path_get(enum rarch_path_type type)
{
case RARCH_PATH_SUBSYSTEM:
return subsystem_path;
case RARCH_PATH_CONFIG:
if (!path_is_config_empty())
return path_config_file;
break;
case RARCH_PATH_CONFIG_APPEND:
if (!path_is_config_append_empty())
return path_config_append_file;
break;
case RARCH_PATH_CORE:
return path_libretro;
default:
@ -581,13 +589,6 @@ bool path_is_config_empty(void)
}
const char *path_get_config(void)
{
if (!path_is_config_empty())
return path_config_file;
return NULL;
}
bool path_get_default_shader_preset(char **preset)
{
@ -662,13 +663,6 @@ bool path_get_content(char **fullpath)
return true;
}
const char *path_get_config_append(void)
{
if (!path_is_config_append_empty())
return path_config_append_file;
return NULL;
}
void path_clear_all(void)
{

View File

@ -90,10 +90,6 @@ const char *path_get_basename(void);
const char *path_get_core_options(void);
const char *path_get_config(void);
const char *path_get_config_append(void);
bool path_get_default_shader_preset(char **preset);
/* clear functions */

View File

@ -944,7 +944,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
if (options_path && string_is_empty(options_path) && !path_is_config_empty())
{
fill_pathname_resolve_relative(buf, path_get_config(),
fill_pathname_resolve_relative(buf, path_get(RARCH_PATH_CONFIG),
file_path_str(FILE_PATH_CORE_OPTIONS_CONFIG), sizeof(buf));
options_path = buf;
}

View File

@ -840,7 +840,7 @@ static void menu_content_environment_get(int *argc, char *argv[],
wrap_args->content_path = NULL;
if (!path_is_config_empty())
wrap_args->config_path = path_get_config();
wrap_args->config_path = path_get(RARCH_PATH_CONFIG);
if (!dir_is_savefile_empty())
wrap_args->sram_path = dir_get_savefile();
if (!dir_is_savestate_empty())