diff --git a/src/screens/FileSelectionScreen.cpp b/src/screens/FileSelectionScreen.cpp index bb73006..b11c4c2 100644 --- a/src/screens/FileSelectionScreen.cpp +++ b/src/screens/FileSelectionScreen.cpp @@ -3,6 +3,14 @@ #include #include +void caseInsensitiveSort(std::vector& strs) { + std::sort(begin(strs), end(strs), [](const std::string& str1, const std::string& str2) { + return lexicographical_compare( + begin(str1), end(str1), begin(str2), end(str2), + [](const char& char1, const char& char2) { return tolower(char1) < tolower(char2); }); + }); +} + void FileSelectionScreen::taskTrampoline(void* param) { auto* self = static_cast(param); self->displayTaskLoop(); @@ -27,6 +35,7 @@ void FileSelectionScreen::loadFiles() { file.close(); } root.close(); + caseInsensitiveSort(files); } void FileSelectionScreen::onEnter() {