Create dir_set function
This commit is contained in:
parent
a4d48688c6
commit
94e245315b
|
@ -1286,7 +1286,7 @@ static void config_set_defaults(void)
|
||||||
sizeof(settings->path.osk_overlay));
|
sizeof(settings->path.osk_overlay));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
dir_set_osk_overlay(temp_path);
|
dir_set(RARCH_DIR_OSK_OVERLAY, temp_path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1296,7 +1296,7 @@ static void config_set_defaults(void)
|
||||||
settings->directory.overlay,
|
settings->directory.overlay,
|
||||||
sizeof(temp_path));
|
sizeof(temp_path));
|
||||||
|
|
||||||
dir_set_osk_overlay(temp_path);
|
dir_set(RARCH_DIR_OSK_OVERLAY, temp_path);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#ifdef HAVE_MENU
|
#ifdef HAVE_MENU
|
||||||
|
@ -1316,11 +1316,11 @@ static void config_set_defaults(void)
|
||||||
|
|
||||||
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
|
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
|
||||||
!string_is_empty(g_defaults.dir.savestate))
|
!string_is_empty(g_defaults.dir.savestate))
|
||||||
dir_set_savestate(g_defaults.dir.savestate);
|
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dir.savestate);
|
||||||
|
|
||||||
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
|
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
|
||||||
!string_is_empty(g_defaults.dir.sram))
|
!string_is_empty(g_defaults.dir.sram))
|
||||||
dir_set_savefile(g_defaults.dir.sram);
|
dir_set(RARCH_DIR_SAVEFILE, g_defaults.dir.sram);
|
||||||
|
|
||||||
if (!string_is_empty(g_defaults.dir.system))
|
if (!string_is_empty(g_defaults.dir.system))
|
||||||
strlcpy(settings->directory.system,
|
strlcpy(settings->directory.system,
|
||||||
|
@ -2123,11 +2123,11 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||||
config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str)))
|
config_get_path(conf, "savefile_directory", tmp_str, sizeof(tmp_str)))
|
||||||
{
|
{
|
||||||
if (string_is_equal(tmp_str, "default"))
|
if (string_is_equal(tmp_str, "default"))
|
||||||
dir_set_savefile(g_defaults.dir.sram);
|
dir_set(RARCH_DIR_SAVEFILE, g_defaults.dir.sram);
|
||||||
|
|
||||||
else if (path_is_directory(tmp_str))
|
else if (path_is_directory(tmp_str))
|
||||||
{
|
{
|
||||||
dir_set_savefile(tmp_str);
|
dir_set(RARCH_DIR_SAVEFILE, tmp_str);
|
||||||
|
|
||||||
strlcpy(global->name.savefile, tmp_str,
|
strlcpy(global->name.savefile, tmp_str,
|
||||||
sizeof(global->name.savefile));
|
sizeof(global->name.savefile));
|
||||||
|
@ -2144,10 +2144,10 @@ static bool config_load_file(const char *path, bool set_defaults,
|
||||||
config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str)))
|
config_get_path(conf, "savestate_directory", tmp_str, sizeof(tmp_str)))
|
||||||
{
|
{
|
||||||
if (string_is_equal(tmp_str, "default"))
|
if (string_is_equal(tmp_str, "default"))
|
||||||
dir_set_savestate(g_defaults.dir.savestate);
|
dir_set(RARCH_DIR_SAVESTATE, g_defaults.dir.savestate);
|
||||||
else if (path_is_directory(tmp_str))
|
else if (path_is_directory(tmp_str))
|
||||||
{
|
{
|
||||||
dir_set_savestate(tmp_str);
|
dir_set(RARCH_DIR_SAVESTATE, tmp_str);
|
||||||
|
|
||||||
strlcpy(global->name.savestate, tmp_str,
|
strlcpy(global->name.savestate, tmp_str,
|
||||||
sizeof(global->name.savestate));
|
sizeof(global->name.savestate));
|
||||||
|
|
65
dirs.c
65
dirs.c
|
@ -305,42 +305,37 @@ const char *dir_get(enum rarch_dir_type type)
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* set functions */
|
void dir_set(enum rarch_dir_type type, const char *path)
|
||||||
|
|
||||||
void dir_set_current_savefile(const char *path)
|
|
||||||
{
|
{
|
||||||
strlcpy(current_savefile_dir, path,
|
switch (type)
|
||||||
sizeof(current_savefile_dir));
|
{
|
||||||
}
|
case RARCH_DIR_CURRENT_SAVEFILE:
|
||||||
|
strlcpy(current_savefile_dir, path,
|
||||||
void dir_set_current_savestate(const char *path)
|
sizeof(current_savefile_dir));
|
||||||
{
|
break;
|
||||||
strlcpy(current_savestate_dir, path,
|
case RARCH_DIR_SAVEFILE:
|
||||||
sizeof(current_savestate_dir));
|
strlcpy(dir_savefile, path,
|
||||||
}
|
sizeof(dir_savefile));
|
||||||
|
break;
|
||||||
void dir_set_osk_overlay(const char *path)
|
case RARCH_DIR_CURRENT_SAVESTATE:
|
||||||
{
|
strlcpy(current_savestate_dir, path,
|
||||||
strlcpy(dir_osk_overlay, path,
|
sizeof(current_savestate_dir));
|
||||||
sizeof(dir_osk_overlay));
|
break;
|
||||||
}
|
case RARCH_DIR_SAVESTATE:
|
||||||
|
strlcpy(dir_savestate, path,
|
||||||
void dir_set_system(const char *path)
|
sizeof(dir_savestate));
|
||||||
{
|
break;
|
||||||
strlcpy(dir_system, path,
|
case RARCH_DIR_SYSTEM:
|
||||||
sizeof(dir_system));
|
strlcpy(dir_system, path,
|
||||||
}
|
sizeof(dir_system));
|
||||||
|
break;
|
||||||
void dir_set_savestate(const char *path)
|
case RARCH_DIR_OSK_OVERLAY:
|
||||||
{
|
strlcpy(dir_osk_overlay, path,
|
||||||
strlcpy(dir_savestate, path,
|
sizeof(dir_osk_overlay));
|
||||||
sizeof(dir_savestate));
|
break;
|
||||||
}
|
case RARCH_DIR_NONE:
|
||||||
|
break;
|
||||||
void dir_set_savefile(const char *path)
|
}
|
||||||
{
|
|
||||||
strlcpy(dir_savefile, path,
|
|
||||||
sizeof(dir_savefile));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void check_defaults_dir_create_dir(const char *path)
|
static void check_defaults_dir_create_dir(const char *path)
|
||||||
|
|
14
dirs.h
14
dirs.h
|
@ -50,19 +50,7 @@ char *dir_get_ptr(enum rarch_dir_type type);
|
||||||
|
|
||||||
const char *dir_get(enum rarch_dir_type type);
|
const char *dir_get(enum rarch_dir_type type);
|
||||||
|
|
||||||
/* set functions */
|
void dir_set(enum rarch_dir_type type, const char *path);
|
||||||
|
|
||||||
void dir_set_current_savefile(const char *path);
|
|
||||||
|
|
||||||
void dir_set_current_savestate(const char *path);
|
|
||||||
|
|
||||||
void dir_set_osk_overlay(const char *path);
|
|
||||||
|
|
||||||
void dir_set_savefile(const char *path);
|
|
||||||
|
|
||||||
void dir_set_savestate(const char *path);
|
|
||||||
|
|
||||||
void dir_set_system(const char *path);
|
|
||||||
|
|
||||||
void dir_check_defaults(void);
|
void dir_check_defaults(void);
|
||||||
|
|
||||||
|
|
|
@ -1034,7 +1034,7 @@ bool rarch_environment_cb(unsigned cmd, void *data)
|
||||||
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",
|
RARCH_WARN("SYSTEM DIR is empty, assume CONTENT DIR %s\n",
|
||||||
fullpath);
|
fullpath);
|
||||||
fill_pathname_basedir(temp_path, fullpath, sizeof(temp_path));
|
fill_pathname_basedir(temp_path, fullpath, sizeof(temp_path));
|
||||||
dir_set_system(temp_path);
|
dir_set(RARCH_DIR_SYSTEM, temp_path);
|
||||||
}
|
}
|
||||||
|
|
||||||
*(const char**)data = dir_get_ptr(RARCH_DIR_SYSTEM);
|
*(const char**)data = dir_get_ptr(RARCH_DIR_SYSTEM);
|
||||||
|
|
4
paths.c
4
paths.c
|
@ -204,8 +204,8 @@ void path_set_redirect(void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
dir_set_current_savefile(new_savefile_dir);
|
dir_set(RARCH_DIR_CURRENT_SAVEFILE, new_savefile_dir);
|
||||||
dir_set_current_savestate(new_savestate_dir);
|
dir_set(RARCH_DIR_CURRENT_SAVESTATE, new_savestate_dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
void path_set_basename(const char *path)
|
void path_set_basename(const char *path)
|
||||||
|
|
|
@ -877,11 +877,11 @@ static void retroarch_parse_input(int argc, char *argv[])
|
||||||
/* Copy SRM/state dirs used, so they can be reused on reentrancy. */
|
/* Copy SRM/state dirs used, so they can be reused on reentrancy. */
|
||||||
if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
|
if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH, NULL) &&
|
||||||
path_is_directory(global->name.savefile))
|
path_is_directory(global->name.savefile))
|
||||||
dir_set_savefile(global->name.savefile);
|
dir_set(RARCH_DIR_SAVEFILE, global->name.savefile);
|
||||||
|
|
||||||
if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
|
if (retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL) &&
|
||||||
path_is_directory(global->name.savestate))
|
path_is_directory(global->name.savestate))
|
||||||
dir_set_savestate(global->name.savestate);
|
dir_set(RARCH_DIR_SAVESTATE, global->name.savestate);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool retroarch_init_state(void)
|
static bool retroarch_init_state(void)
|
||||||
|
|
Loading…
Reference in New Issue