Skip to content

Commit

Permalink
Map multiple data directories to USVFS
Browse files Browse the repository at this point in the history
  • Loading branch information
Silarn committed Sep 5, 2023
1 parent 3f33571 commit fdc4ebd
Showing 1 changed file with 18 additions and 10 deletions.
28 changes: 18 additions & 10 deletions src/organizercore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1984,8 +1984,12 @@ std::vector<Mapping> OrganizerCore::fileMapping(const QString &profileName,

MappingType result;

QString dataPath
= QDir::toNativeSeparators(game->dataDirectory().absolutePath());
QStringList dataPaths;
dataPaths.append(QDir::toNativeSeparators(game->dataDirectory().absolutePath()));

for (auto directory : game->secondaryDataDirectories()) {
dataPaths.append(directory.absolutePath());
}

bool overwriteActive = false;

Expand All @@ -2002,8 +2006,10 @@ std::vector<Mapping> OrganizerCore::fileMapping(const QString &profileName,
overwriteActive |= createTarget;

if (modPtr->isRegular()) {
result.insert(result.end(), {QDir::toNativeSeparators(std::get<1>(mod)),
dataPath, true, createTarget});
for (auto dataPath : dataPaths) {
result.insert(result.end(), { QDir::toNativeSeparators(std::get<1>(mod)),
dataPath, true, createTarget });
}
}
}

Expand All @@ -2024,12 +2030,14 @@ std::vector<Mapping> OrganizerCore::fileMapping(const QString &profileName,
}
}

result.insert(result.end(), {
QDir::toNativeSeparators(m_Settings.paths().overwrite()),
dataPath,
true,
customOverwrite.isEmpty()
});
for (auto dataPath : dataPaths) {
result.insert(result.end(), {
QDir::toNativeSeparators(m_Settings.paths().overwrite()),
dataPath,
true,
customOverwrite.isEmpty()
});
}

for (MOBase::IPluginFileMapper *mapper :
m_PluginContainer->plugins<MOBase::IPluginFileMapper>()) {
Expand Down

0 comments on commit fdc4ebd

Please sign in to comment.