Create dir_clear

This commit is contained in:
twinaphex 2016-10-01 23:26:59 +02:00
parent 72fff59efd
commit bdf379d568
3 changed files with 26 additions and 31 deletions

View File

@ -1143,9 +1143,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, NULL))
dir_clear_savefile();
dir_clear(RARCH_DIR_SAVEFILE);
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_STATE_PATH, NULL))
dir_clear_savestate();
dir_clear(RARCH_DIR_SAVESTATE);
*settings->path.libretro_info = '\0';
if (!retroarch_override_setting_is_set(RARCH_OVERRIDE_SETTING_LIBRETRO_DIRECTORY, NULL))
@ -2101,7 +2101,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';

43
dirs.c
View File

@ -216,32 +216,33 @@ 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_SAVEFILE:
*dir_savefile = '\0';
break;
case RARCH_DIR_SAVESTATE:
*dir_savestate = '\0';
break;
case RARCH_DIR_SYSTEM:
*dir_system = '\0';
break;
case RARCH_DIR_OSK_OVERLAY:
*dir_osk_overlay = '\0';
break;
case RARCH_DIR_NONE:
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 */

8
dirs.h
View File

@ -54,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);