Mercurial > repos > blastem
comparison util.c @ 1484:d82af64c94d2 nuklear_ui
Sort directory listing in Nuklear UI file browser
author | Michael Pavone <pavone@retrodev.com> |
---|---|
date | Sun, 26 Nov 2017 17:33:39 -0800 |
parents | e2bd03ed3190 |
children | 369da70ee2c2 |
comparison
equal
deleted
inserted
replaced
1483:001120e91fed | 1484:d82af64c94d2 |
---|---|
678 free(list[i].name); | 678 free(list[i].name); |
679 } | 679 } |
680 free(list); | 680 free(list); |
681 } | 681 } |
682 | 682 |
683 static int sort_dir_alpha(const void *a, const void *b) | |
684 { | |
685 const dir_entry *da, *db; | |
686 da = a; | |
687 db = b; | |
688 if (da->is_dir != db->is_dir) { | |
689 return db->is_dir - da->is_dir; | |
690 } | |
691 return strcasecmp(((dir_entry *)a)->name, ((dir_entry *)b)->name); | |
692 } | |
693 | |
694 void sort_dir_list(dir_entry *list, size_t num_entries) | |
695 { | |
696 qsort(list, num_entries, sizeof(dir_entry), sort_dir_alpha); | |
697 } | |
698 | |
683 #ifdef __ANDROID__ | 699 #ifdef __ANDROID__ |
684 | 700 |
685 #include <SDL.h> | 701 #include <SDL.h> |
686 char *read_bundled_file(char *name, uint32_t *sizeret) | 702 char *read_bundled_file(char *name, uint32_t *sizeret) |
687 { | 703 { |