diff options
| author | Chris Bessent <lost.dragonist@gmail.com> | 2021-01-16 17:59:24 -0700 |
|---|---|---|
| committer | Chris Bessent <lost.dragonist@gmail.com> | 2021-01-16 18:02:16 -0700 |
| commit | 3dbee687260a02fa523071ec3f351652cb386144 (patch) | |
| tree | d2fb84c22e147c5b49649616cec257f397921fb5 | |
| parent | 2b1f01cba2a50a17db69187a1b4cbecf5a0fb65d (diff) | |
Make modlist.txt less case sensitive
This should make it so case doesn't matter when it comes to the
folder names of mods and what's in modlist.txt. If a mismatch
in case is detected, modlist.txt will be flagged dirty to fix
it at some point.
This handles the foillowing cases:
* modlist.txt was modified outside MO
* the mod folder was renamed outside MO
| -rw-r--r-- | src/profile.cpp | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/profile.cpp b/src/profile.cpp index 3cc1a2a3..5a71cacb 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -410,9 +410,18 @@ void Profile::refreshModStatus() } else { namesRead.insert(lookupName); } - unsigned int modIndex = ModInfo::getIndex(lookupName); + unsigned int modIndex = ModInfo::findMod( + [lookupName](ModInfo::Ptr info) { + return info->name().compare(lookupName, Qt::CaseInsensitive) == 0; + } + ); if (modIndex != UINT_MAX) { ModInfo::Ptr info = ModInfo::getByIndex(modIndex); + if (info->name().compare(lookupName) != 0) { + // name in modlist.txt doesn't match case of actual folder + // need to rewrite the modlist to fix this + modStatusModified = true; + } if ((modIndex < m_ModStatus.size()) && (info->getFixedPriority() == INT_MIN)) { m_ModStatus[modIndex].m_Enabled = enabled; |
