From 2b14b58dcf85bd23bbddddb4ea6ba66265c76663 Mon Sep 17 00:00:00 2001 From: Pk11 Date: Sat, 20 Aug 2022 16:23:14 -0500 Subject: [PATCH] Case insensitive sort the download list (as uppercase so `[` is at the end) --- source/store/store.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/source/store/store.cpp b/source/store/store.cpp index e0e1d7d..aabe3c6 100644 --- a/source/store/store.cpp +++ b/source/store/store.cpp @@ -483,6 +483,20 @@ std::vector Store::GetDownloadList(int index) const { if (it.key() != "info") temp.push_back(it.key()); } + std::sort(temp.begin(), temp.end(), [](const std::string &aString, const std::string &bString) { + const char *a = aString.c_str(), *b = bString.c_str(); + while (*a && *b) { + int cmp = toupper(*a) - toupper(*b); + if (cmp < 0) return true; + else if (cmp > 0) return false; + + a++; + b++; + } + + return *a == 0; + }); + return temp; }