Skip to content

Commit

Permalink
sort mods by id in crashlog
Browse files Browse the repository at this point in the history
  • Loading branch information
matcool committed Jan 30, 2024
1 parent ea81897 commit 984d148
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions loader/src/internal/crashlog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,13 @@ void crashlog::printMods(std::stringstream& stream) {
if (mods.empty()) {
stream << "<None>\n";
}
std::sort(mods.begin(), mods.end(), [](Mod* a, Mod* b) {
auto const s1 = a->getID();
auto const s2 = b->getID();
return std::lexicographical_compare(s1.begin(), s1.end(), s2.begin(), s2.end(), [](auto a, auto b) {
return std::tolower(a) < std::tolower(b);
});
});
using namespace std::string_view_literals;
for (auto& mod : mods) {
stream << fmt::format("{} | [{}] {}\n",
Expand Down

0 comments on commit 984d148

Please sign in to comment.