diff options
author | Michael Pavone <pavone@retrodev.com> | 2017-11-25 13:57:38 -0800 |
---|---|---|
committer | Michael Pavone <pavone@retrodev.com> | 2017-11-25 13:57:38 -0800 |
commit | 2900092e4e06be77108ed6b8a66c7aa673d0b494 (patch) | |
tree | 0dea1d08e10839ff4403ca27123b51cda6878e64 /nuklear_ui | |
parent | 01cfcb11d24235ba7b3a25c05ce1bdabe5b3015d (diff) |
Fix directory navigation in ROM file chooser in Nuklear UI
--HG--
branch : nuklear_ui
Diffstat (limited to 'nuklear_ui')
-rw-r--r-- | nuklear_ui/blastem_nuklear.c | 13 |
1 files changed, 7 insertions, 6 deletions
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; } |