Skip to content

Commit

Permalink
More changes to deal with secondary data directories
Browse files Browse the repository at this point in the history
  • Loading branch information
Silarn committed Jun 17, 2024
1 parent 944ab50 commit 475cbe2
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src/modinfowithconflictinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,15 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co
bool providesAnything = false;
bool hasHiddenFiles = false;

int dataID = 0;
QList<int> dataIDs;
if (m_Core.directoryStructure()->originExists(L"data")) {
dataID = m_Core.directoryStructure()->getOriginByName(L"data").getID();
dataIDs.append(m_Core.directoryStructure()->getOriginByName(L"data").getID());
}
for (auto origin : m_Core.managedGame()->secondaryDataDirectories().keys()) {
if (m_Core.directoryStructure()->originExists(origin.toStdWString())) {
dataIDs.append(
m_Core.directoryStructure()->getOriginByName(origin.toStdWString()).getID());
}
}

std::wstring name = ToWString(this->name());
Expand Down Expand Up @@ -145,7 +151,8 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co
}

auto alternatives = file->getAlternatives();
if ((alternatives.size() == 0) || (alternatives.back().originID() == dataID)) {
if ((alternatives.size() == 0) ||
dataIDs.contains(alternatives.back().originID())) {
// no alternatives -> no conflict
providesAnything = true;
} else {
Expand Down Expand Up @@ -181,7 +188,7 @@ ModInfoWithConflictInfo::Conflicts ModInfoWithConflictInfo::doConflictCheck() co

// Sort out the alternatives
for (const auto& altInfo : alternatives) {
if ((altInfo.originID() != dataID) &&
if ((!dataIDs.contains(altInfo.originID())) &&
(altInfo.originID() != origin.getID())) {
FilesOrigin& altOrigin =
m_Core.directoryStructure()->getOriginByID(altInfo.originID());
Expand Down

0 comments on commit 475cbe2

Please sign in to comment.