Sort installed mods list alphabetically#29325
Conversation
| std::string entry; | ||
| }; | ||
|
|
||
| std::optional<AddonInfo> getModuleInfo(const std::string& path) |
There was a problem hiding this comment.
| std::optional<AddonInfo> getModuleInfo(const std::string& path) | |
| static std::optional<AddonInfo> getModuleInfo(const std::string& path) |
|
Tested, works to |
|
Thanks for the PR, @zeel2104 -- can you explain the design decision to make a struct with two strings in it, instead of just creating a vector of strings and sorting that? |
|
I can't reproduce the issue this PR fixes. For me, they are already sorted alphabetically (even though I installed them in a different order on purpose). Perhaps it's OS-dependent? Or depends on when they were installed? |
|
@FEA-eng It is OS-dependent, specifically filesystem-dependent. |
|
@chennes The displayed line is not just the addon name: it may also include the version, disabled state, and preserves the existing formatted entry text. Sorting only a With the struct, If you prefer, I can refactor it to a more compact representation like |
|
That feels over-engineered to me: this is effectively debugging output, with a well-structured, straightforward format. I suggest simply renaming |
|
@chennes |
| void ProgramInformation::addModuleInfo(std::stringstream& str, const std::string& path) | ||
| { | ||
| QString modPath = QString::fromStdString(path); | ||
| QFileInfo mod(modPath); | ||
| if (mod.isHidden()) { // Ignore hidden directories | ||
| return; | ||
| auto moduleInfo = getModuleInfoString(path); | ||
| if (!moduleInfo.empty()) { | ||
| str << moduleInfo; | ||
| } |
There was a problem hiding this comment.
Now we can just get rid of this whole function, it's unnecessary.
There was a problem hiding this comment.
Done - removed addModuleInfo entirely since it’s redundant now.
|
You can avoid the large diff by putting the function back where the original one was, so it's clear at a glance that this is a nice, small change: basically the function signature and a little bit of plumbing. |
|
Done. I moved getModuleInfoString() back to the original helper location so the diff is easier to review at a glance. The behavior is unchanged. |
|
Sorry I wasn't clearer in my last comment: the original function, |
|
@chennes |
Sort the Installed mods list in About > Version alphabetically while keeping the existing entry formatting unchanged.
Issues
Fixes #28927
Before and After Images
Not applicable for this small text-ordering change in the About > Version output.
Testing
pixi