diff --git a/configuration.c b/configuration.c index 492d87c7a1..f21a722418 100644 --- a/configuration.c +++ b/configuration.c @@ -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'; diff --git a/dirs.c b/dirs.c index 5e047e7d75..3d0313921f 100644 --- a/dirs.c +++ b/dirs.c @@ -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 */ diff --git a/dirs.h b/dirs.h index fb32442682..2c54f508ba 100644 --- a/dirs.h +++ b/dirs.h @@ -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);