From 2900092e4e06be77108ed6b8a66c7aa673d0b494 Mon Sep 17 00:00:00 2001 From: Michael Pavone Date: Sat, 25 Nov 2017 13:57:38 -0800 Subject: Fix directory navigation in ROM file chooser in Nuklear UI --HG-- branch : nuklear_ui --- nuklear_ui/blastem_nuklear.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'nuklear_ui') diff --git a/nuklear_ui/blastem_nuklear.c b/nuklear_ui/blastem_nuklear.c index a486a64..bcff610 100644 --- a/nuklear_ui/blastem_nuklear.c +++ b/nuklear_ui/blastem_nuklear.c @@ -28,7 +28,9 @@ void view_load(struct nk_context *context) static dir_entry *entries; static size_t num_entries; static uint32_t selected_entry; - get_initial_browse_path(¤t_path); + if (!current_path) { + get_initial_browse_path(¤t_path); + } if (!entries) { entries = get_dir_list(current_path, &num_entries); } @@ -53,15 +55,14 @@ void view_load(struct nk_context *context) current_view = previous_view; } if (nk_button_label(context, "Open")) { - char const *pieces[] = {current_path, PATH_SEP, entries[selected_entry].name}; + char *full_path = path_append(current_path, entries[selected_entry].name); if (entries[selected_entry].is_dir) { - char *old = current_path; - current_path = alloc_concat_m(3, pieces); - free(old); + free(current_path); + current_path = full_path; free_dir_list(entries, num_entries); entries = NULL; } else { - current_system->next_rom = alloc_concat_m(3, pieces); + current_system->next_rom = full_path; current_system->request_exit(current_system); current_view = view_play; } -- cgit v1.2.3