Add more functionality to path_set
This commit is contained in:
parent
b8a1052b73
commit
7e1a61570a
|
@ -1342,7 +1342,7 @@ static void config_set_defaults(void)
|
|||
char temp_str[PATH_MAX_LENGTH];
|
||||
fill_pathname_expand_special(temp_str,
|
||||
g_defaults.path.config, sizeof(temp_str));
|
||||
path_set_config(temp_str);
|
||||
path_set(RARCH_PATH_CONFIG, temp_str);
|
||||
}
|
||||
|
||||
/* Avoid reloading config on every content load */
|
||||
|
@ -1540,7 +1540,7 @@ static config_file_t *open_default_config_file(void)
|
|||
if (!conf)
|
||||
return NULL;
|
||||
|
||||
path_set_config(conf_path);
|
||||
path_set(RARCH_PATH_CONFIG, conf_path);
|
||||
|
||||
return conf;
|
||||
}
|
||||
|
@ -1926,7 +1926,7 @@ static bool config_load_file(const char *path, bool set_defaults,
|
|||
|
||||
#ifndef HAVE_DYNAMIC
|
||||
if (config_get_path(conf, "libretro_path", tmp_str, sizeof(tmp_str)))
|
||||
path_set_core(tmp_str);
|
||||
path_set(RARCH_PATH_CORE, tmp_str);
|
||||
#endif
|
||||
|
||||
#ifdef RARCH_CONSOLE
|
||||
|
@ -2294,7 +2294,7 @@ bool config_load_override(void)
|
|||
|
||||
/* Restore the libretro_path we're using
|
||||
* since it will be overwritten by the override when reloading. */
|
||||
path_set_core(buf);
|
||||
path_set(RARCH_PATH_CORE, buf);
|
||||
runloop_msg_queue_push("Configuration override loaded.", 1, 100, true);
|
||||
|
||||
/* Reset save paths. */
|
||||
|
@ -3263,7 +3263,7 @@ bool config_replace(char *path)
|
|||
if (settings->config_save_on_exit && !path_is_config_empty())
|
||||
config_save_file(path_get_config());
|
||||
|
||||
path_set_config(path);
|
||||
path_set(RARCH_PATH_CONFIG, path);
|
||||
|
||||
rarch_ctl(RARCH_CTL_UNSET_BLOCK_CONFIG_READ, NULL);
|
||||
|
||||
|
|
33
paths.c
33
paths.c
|
@ -251,14 +251,13 @@ struct string_list *path_get_subsystem_list(void)
|
|||
|
||||
const char *path_get_current_savefile_dir(void)
|
||||
{
|
||||
char *ret = current_savefile_dir;
|
||||
|
||||
/* try to infer the path in case it's still empty by calling
|
||||
path_set_redirect */
|
||||
if (string_is_empty(ret) && !content_does_not_need_content())
|
||||
if (string_is_empty(current_savefile_dir)
|
||||
&& !content_does_not_need_content())
|
||||
path_set_redirect();
|
||||
|
||||
return ret;
|
||||
return current_savefile_dir;
|
||||
}
|
||||
|
||||
void path_set_special(char **argv, unsigned num_content)
|
||||
|
@ -497,11 +496,6 @@ size_t path_get_core_size(void)
|
|||
return sizeof(path_libretro);
|
||||
}
|
||||
|
||||
void path_set_core(const char *path)
|
||||
{
|
||||
strlcpy(path_libretro, path, sizeof(path_libretro));
|
||||
}
|
||||
|
||||
bool path_set(enum rarch_path_type type, const char *path)
|
||||
{
|
||||
if (!path)
|
||||
|
@ -509,14 +503,25 @@ bool path_set(enum rarch_path_type type, const char *path)
|
|||
|
||||
switch (type)
|
||||
{
|
||||
case RARCH_PATH_CORE:
|
||||
strlcpy(path_libretro, path,
|
||||
sizeof(path_libretro));
|
||||
break;
|
||||
case RARCH_PATH_CONFIG:
|
||||
strlcpy(path_config_file, path,
|
||||
sizeof(path_config_file));
|
||||
break;
|
||||
case RARCH_PATH_SUBSYSTEM:
|
||||
strlcpy(subsystem_path, path, sizeof(subsystem_path));
|
||||
strlcpy(subsystem_path, path,
|
||||
sizeof(subsystem_path));
|
||||
break;
|
||||
case RARCH_PATH_CORE_OPTIONS:
|
||||
strlcpy(path_core_options_file, path, sizeof(path_core_options_file));
|
||||
strlcpy(path_core_options_file, path,
|
||||
sizeof(path_core_options_file));
|
||||
break;
|
||||
case RARCH_PATH_CONTENT:
|
||||
strlcpy(path_content, path, sizeof(path_content));
|
||||
strlcpy(path_content, path,
|
||||
sizeof(path_content));
|
||||
break;
|
||||
default:
|
||||
case RARCH_PATH_NONE:
|
||||
|
@ -559,10 +564,6 @@ bool path_is_config_empty(void)
|
|||
return false;
|
||||
}
|
||||
|
||||
void path_set_config(const char *path)
|
||||
{
|
||||
strlcpy(path_config_file, path, sizeof(path_config_file));
|
||||
}
|
||||
|
||||
const char *path_get_config(void)
|
||||
{
|
||||
|
|
8
paths.h
8
paths.h
|
@ -34,6 +34,8 @@ enum rarch_content_type
|
|||
enum rarch_path_type
|
||||
{
|
||||
RARCH_PATH_NONE = 0,
|
||||
RARCH_PATH_CORE,
|
||||
RARCH_PATH_CONFIG,
|
||||
RARCH_PATH_CONTENT,
|
||||
RARCH_PATH_CORE_OPTIONS,
|
||||
RARCH_PATH_SUBSYSTEM
|
||||
|
@ -61,12 +63,6 @@ void path_set_special(char **argv, unsigned num_content);
|
|||
|
||||
void path_set_basename(const char *path);
|
||||
|
||||
void path_set_core(const char *path);
|
||||
|
||||
void path_set_core_options(const char *path);
|
||||
|
||||
void path_set_config(const char *path);
|
||||
|
||||
void path_set_config_append(const char *path);
|
||||
|
||||
bool path_set_default_shader_preset(const char *preset);
|
||||
|
|
|
@ -589,7 +589,7 @@ static void retroarch_parse_input(int argc, char *argv[])
|
|||
break;
|
||||
|
||||
case 'c':
|
||||
path_set_config(optarg);
|
||||
path_set(RARCH_PATH_CONFIG, optarg);
|
||||
break;
|
||||
|
||||
case 'r':
|
||||
|
|
|
@ -708,13 +708,7 @@ bool runloop_ctl(enum runloop_ctl_state state, void *data)
|
|||
}
|
||||
break;
|
||||
case RUNLOOP_CTL_SET_LIBRETRO_PATH:
|
||||
{
|
||||
const char *fullpath = (const char*)data;
|
||||
if (!fullpath)
|
||||
return false;
|
||||
path_set_core(fullpath);
|
||||
}
|
||||
break;
|
||||
return path_set(RARCH_PATH_CORE, (const char*)data);
|
||||
case RUNLOOP_CTL_FRAME_TIME_FREE:
|
||||
memset(&runloop_frame_time, 0,
|
||||
sizeof(struct retro_frame_time_callback));
|
||||
|
|
Loading…
Reference in New Issue