mirror of
https://github.com/Huntereb/Awoo-Installer
synced 2024-11-10 06:04:20 +00:00
use lambda for file sorting
This commit is contained in:
parent
32fe03aac3
commit
975577fe81
1 changed files with 5 additions and 7 deletions
|
@ -52,14 +52,12 @@ namespace inst::util {
|
||||||
splExit();
|
splExit();
|
||||||
}
|
}
|
||||||
|
|
||||||
struct caseInsensitiveLess : public std::binary_function< char,char,bool > {
|
|
||||||
bool operator () (char x, char y) const {
|
|
||||||
return toupper(static_cast< unsigned char >(x)) < toupper(static_cast< unsigned char >(y));
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
bool ignoreCaseCompare(const std::string &a, const std::string &b) {
|
bool ignoreCaseCompare(const std::string &a, const std::string &b) {
|
||||||
return std::lexicographical_compare(a.begin(), a.end() , b.begin() ,b.end() , caseInsensitiveLess());
|
const auto case_insensitive_less = [](char x, char y) {
|
||||||
|
return toupper(static_cast<unsigned char>(x)) < toupper(static_cast<unsigned char>(y));
|
||||||
|
};
|
||||||
|
|
||||||
|
return std::lexicographical_compare(a.begin(), a.end(), b.begin(), b.end(), case_insensitive_less);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions) {
|
std::vector<std::filesystem::path> getDirectoryFiles(const std::string & dir, const std::vector<std::string> & extensions) {
|
||||||
|
|
Loading…
Reference in a new issue