Create dir_clear

This commit is contained in:
twinaphex 2016-09-30 07:02:23 +02:00
parent 28a96fbb05
commit d7d49c36c7
3 changed files with 36 additions and 31 deletions

View File

@ -1144,9 +1144,9 @@ static void config_set_defaults(void)
/* Make sure settings from other configs carry over into defaults
* for another config. */
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_SAVE_PATH))
dir_clear_savefile();
dir_clear(RARCH_DIR_SAVEFILE);
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH))
dir_clear_savestate();
dir_clear(RARCH_DIR_SAVESTATE);
*settings->path.libretro_info = '\0';
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO_DIRECTORY))
@ -2086,7 +2086,7 @@ static bool config_load_file(const char *path, bool set_defaults,
if (string_is_equal(settings->directory.overlay, "default"))
*settings->directory.overlay = '\0';
if (string_is_equal(dir_get_osk_overlay(), "default"))
dir_clear_osk_overlay();
dir_clear(RARCH_DIR_OSK_OVERLAY);
#endif
if (string_is_equal(settings->directory.system, "default"))
*settings->directory.system = '\0';

44
dirs.c
View File

@ -212,32 +212,34 @@ size_t dir_get_osk_overlay_size(void)
/* clear functions */
void dir_clear_system(void)
void dir_clear(enum rarch_dir_type type)
{
*dir_system = '\0';
}
void dir_clear_savefile(void)
{
*dir_savefile = '\0';
}
void dir_clear_savestate(void)
{
*dir_savestate = '\0';
}
void dir_clear_osk_overlay(void)
{
*dir_osk_overlay = '\0';
switch (type)
{
case RARCH_DIR_SYSTEM:
*dir_system = '\0';
break;
case RARCH_DIR_SAVEFILE:
*dir_savefile = '\0';
break;
case RARCH_DIR_SAVESTATE:
*dir_savestate = '\0';
break;
case RARCH_DIR_OSK_OVERLAY:
*dir_osk_overlay = '\0';
break;
case RARCH_DIR_NONE:
default:
break;
}
}
void dir_clear_all(void)
{
dir_clear_system();
dir_clear_osk_overlay();
dir_clear_savefile();
dir_clear_savestate();
dir_clear(RARCH_DIR_SYSTEM);
dir_clear(RARCH_DIR_OSK_OVERLAY);
dir_clear(RARCH_DIR_SAVEFILE);
dir_clear(RARCH_DIR_SAVESTATE);
}
/* get ptr functions */

17
dirs.h
View File

@ -21,6 +21,15 @@
RETRO_BEGIN_DECLS
enum rarch_dir_type
{
RARCH_DIR_NONE = 0,
RARCH_DIR_SYSTEM,
RARCH_DIR_SAVEFILE,
RARCH_DIR_SAVESTATE,
RARCH_DIR_OSK_OVERLAY
};
/* init functions */
bool dir_init_shader(void);
@ -45,13 +54,7 @@ bool dir_is_osk_overlay_empty(void);
/* clear functions */
void dir_clear_system(void);
void dir_clear_savefile(void);
void dir_clear_savestate(void);
void dir_clear_osk_overlay(void);
void dir_clear(enum rarch_dir_type type);
void dir_clear_all(void);