diff --git a/frontend/menu/backend/menu_common_backend.c b/frontend/menu/backend/menu_common_backend.c index 99eecea9d2..5cdf31982f 100644 --- a/frontend/menu/backend/menu_common_backend.c +++ b/frontend/menu/backend/menu_common_backend.c @@ -755,7 +755,6 @@ static int menu_action_ok(const char *menu_path, #if 0 RARCH_LOG("menu label: %s\n", menu_label); - RARCH_LOG("type : %d\n", type == MENU_FILE_USE_DIRECTORY); RARCH_LOG("type id : %d\n", type); #endif while (true) @@ -889,17 +888,6 @@ static int menu_action_ok(const char *menu_path, } return 0; - - case MENU_FILE_USE_DIRECTORY: - - if (setting && setting->type == ST_DIR) - { - menu_action_setting_set_current_string(setting, menu_path); - menu_entries_pop_stack(driver.menu->menu_stack, setting->name); - } - - return 0; - case MENU_FILE_DIRECTORY: case MENU_FILE_CARCHIVE: diff --git a/frontend/menu/menu_entries_cbs.c b/frontend/menu/menu_entries_cbs.c index 02801cdafe..428a248d49 100644 --- a/frontend/menu/menu_entries_cbs.c +++ b/frontend/menu/menu_entries_cbs.c @@ -13,6 +13,7 @@ * If not, see . */ +#include "menu_action.h" #include "menu_common.h" #include "menu_input_line_cb.h" #include "menu_entries.h" @@ -137,6 +138,32 @@ static int action_ok_shader_preset_save_as(const char *path, return 0; } +static int action_ok_path_use_directory(const char *path, + const char *label, unsigned type, size_t index) +{ + const char *menu_label = NULL; + const char *menu_path = NULL; + rarch_setting_t *setting = NULL; + + if (!driver.menu) + return -1; + + file_list_get_last(driver.menu->menu_stack, &menu_path, &menu_label, NULL); + setting = (rarch_setting_t*) + setting_data_find_setting(driver.menu->list_settings, menu_label); + + if (!setting) + return -1; + + if (setting->type == ST_DIR) + { + menu_action_setting_set_current_string(setting, menu_path); + menu_entries_pop_stack(driver.menu->menu_stack, setting->name); + } + + return 0; +} + /* Bind the OK callback function */ static int menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, @@ -148,6 +175,8 @@ static int menu_entries_cbs_init_bind_ok(menu_file_list_cbs_t *cbs, cbs->action_ok = action_ok_shader_preset_load; else if (type == MENU_FILE_SHADER) cbs->action_ok = action_ok_shader_pass_load; + else if (type == MENU_FILE_USE_DIRECTORY) + cbs->action_ok = action_ok_path_use_directory; else return -1;