mirror of
https://github.com/libretro/RetroArch
synced 2025-03-29 22:20:21 +00:00
[nk] implement directory sorting
This commit is contained in:
parent
fafb5cc272
commit
2667289d45
@ -57,7 +57,7 @@ static void nk_menu_main(nk_menu_handle_t *nk)
|
||||
if (nk->window[NK_WND_SETTINGS].open)
|
||||
nk_wnd_settings(nk);
|
||||
if (nk->window[NK_WND_FILE_PICKER].open)
|
||||
nk_wnd_file_picker(nk, settings->directory.menu_content);
|
||||
nk_wnd_file_picker(nk, NULL, NULL, NULL);
|
||||
if (nk->window[NK_WND_SHADER_PARAMETERS].open)
|
||||
nk_wnd_shader_parameters(nk);
|
||||
if (nk->window[NK_WND_MAIN].open)
|
||||
|
@ -95,7 +95,7 @@ typedef struct nk_menu_handle
|
||||
|
||||
void nk_wnd_shader_parameters(nk_menu_handle_t *zr);
|
||||
void nk_wnd_main(nk_menu_handle_t *zr);
|
||||
void nk_wnd_file_picker(nk_menu_handle_t *zr, const char* startup_path);
|
||||
bool nk_wnd_file_picker(nk_menu_handle_t *nk, const char* in, const char* out, const char* filter);
|
||||
void nk_wnd_settings(nk_menu_handle_t *zr);
|
||||
void nk_wnd_set_state(nk_menu_handle_t *zr, const int id,
|
||||
struct nk_vec2 pos, struct nk_vec2 size);
|
||||
|
@ -61,7 +61,7 @@ void load_icons(nk_menu_handle_t *nk)
|
||||
assets_loaded = true;
|
||||
}
|
||||
|
||||
void nk_wnd_file_picker(nk_menu_handle_t *nk, const char* startup_path)
|
||||
bool nk_wnd_file_picker(nk_menu_handle_t *nk, const char* in, const char* out, const char* filter)
|
||||
{
|
||||
struct nk_panel layout;
|
||||
struct nk_context *ctx = &nk->ctx;
|
||||
@ -77,10 +77,10 @@ void nk_wnd_file_picker(nk_menu_handle_t *nk, const char* startup_path)
|
||||
frontend_driver_parse_drive_list(drives);
|
||||
}
|
||||
|
||||
if (!string_is_empty(startup_path) && string_is_empty(path))
|
||||
if (!string_is_empty(in) && string_is_empty(path))
|
||||
{
|
||||
RARCH_LOG("beep\n");
|
||||
strlcpy(path, startup_path, sizeof(path));
|
||||
strlcpy(path, in, sizeof(path));
|
||||
files = dir_list_new(path, NULL, true, true);
|
||||
}
|
||||
|
||||
@ -135,7 +135,13 @@ void nk_wnd_file_picker(nk_menu_handle_t *nk, const char* startup_path)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* sort the dir list with directories first */
|
||||
dir_list_sort(files, true);
|
||||
|
||||
/* save position and size to restore after context reset */
|
||||
nk_wnd_set_state(nk, id, nk_window_get_position(ctx), nk_window_get_size(ctx));
|
||||
nk_end(ctx);
|
||||
|
||||
return false;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user