summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-12-27 02:18:40 +0100
committerPetr Mrázek <peterix@gmail.com>2013-12-27 02:18:40 +0100
commit4bf1cac8d89809106819c86543ef8efbf78f163f (patch)
treec7ac25200ef42f421b1c94840da8927135e3cf4e /logic
parentaa91d89aaafd21f5196a250b3764c44050ebd990 (diff)
downloadMultiMC-4bf1cac8d89809106819c86543ef8efbf78f163f.tar
MultiMC-4bf1cac8d89809106819c86543ef8efbf78f163f.tar.gz
MultiMC-4bf1cac8d89809106819c86543ef8efbf78f163f.tar.lz
MultiMC-4bf1cac8d89809106819c86543ef8efbf78f163f.tar.xz
MultiMC-4bf1cac8d89809106819c86543ef8efbf78f163f.zip
Handle the foo + foo.disabled jar mod corner case better.
Diffstat (limited to 'logic')
-rw-r--r--logic/ModList.cpp21
1 files changed, 17 insertions, 4 deletions
diff --git a/logic/ModList.cpp b/logic/ModList.cpp
index dbc85320..eb7f3128 100644
--- a/logic/ModList.cpp
+++ b/logic/ModList.cpp
@@ -81,14 +81,24 @@ bool ModList::update()
QFileInfo infoDisabled(m_dir.filePath(item.id + ".disabled"));
int idxEnabled = folderContents.indexOf(infoEnabled);
int idxDisabled = folderContents.indexOf(infoDisabled);
- // if both enabled and disabled versions are present, PANIC!
+ bool isEnabled;
+ // if both enabled and disabled versions are present, it's a special case...
if (idxEnabled >= 0 && idxDisabled >= 0)
{
- return false;
+ // we only process the one we actually have in the order file.
+ // and exactly as we have it.
+ // THIS IS A CORNER CASE
+ isEnabled = item.enabled;
+ }
+ else
+ {
+ // only one is present.
+ // we pick the one that we found.
+ // we assume the mod was enabled/disabled by external means
+ isEnabled = idxEnabled >= 0;
}
- bool isEnabled = idxEnabled >= 0;
int idx = isEnabled ? idxEnabled : idxDisabled;
- QFileInfo info = isEnabled ? infoEnabled : infoDisabled;
+ QFileInfo & info = isEnabled ? infoEnabled : infoDisabled;
// if the file from the index file exists
if (idx != -1)
{
@@ -226,6 +236,9 @@ bool ModList::installMod(const QFileInfo &filename, int index)
int idx = mods.indexOf(m);
if (idx != -1)
{
+ int idx2 = mods.indexOf(m,idx+1);
+ if(idx2 != -1)
+ return false;
if (mods[idx].replace(m))
{