mirror of https://github.com/mgba-emu/mgba.git
GUI: Sort file lists
This commit is contained in:
parent
d5697971a9
commit
15037950f0
|
@ -9,6 +9,8 @@
|
|||
#include "util/vector.h"
|
||||
#include "util/vfs.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
|
||||
DECLARE_VECTOR(FileList, char*);
|
||||
DEFINE_VECTOR(FileList, char*);
|
||||
|
||||
|
@ -40,6 +42,10 @@ static void _upDirectory(char* currentPath) {
|
|||
// TODO: What if there was a trailing slash?
|
||||
}
|
||||
|
||||
static int _strpcmp(const void* a, const void* b) {
|
||||
return strcmp(*(const char**) a, *(const char**) b);
|
||||
}
|
||||
|
||||
static bool _refreshDirectory(const struct GUIParams* params, const char* currentPath, struct FileList* currentFiles, bool (*filter)(struct VFile*)) {
|
||||
_cleanFiles(currentFiles);
|
||||
|
||||
|
@ -76,6 +82,7 @@ static bool _refreshDirectory(const struct GUIParams* params, const char* curren
|
|||
}
|
||||
}
|
||||
dir->close(dir);
|
||||
qsort(FileListGetPointer(currentFiles, 1), FileListSize(currentFiles) - 1, sizeof(char*), _strpcmp);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue