From fdc4ebd18ce3c988f85abdc894e1e2d736f4ff65 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Mon, 4 Sep 2023 22:20:25 -0500 Subject: [PATCH] Map multiple data directories to USVFS --- src/organizercore.cpp | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/src/organizercore.cpp b/src/organizercore.cpp index 3a959cb38..f75a8717d 100644 --- a/src/organizercore.cpp +++ b/src/organizercore.cpp @@ -1984,8 +1984,12 @@ std::vector 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; @@ -2002,8 +2006,10 @@ std::vector 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 }); + } } } @@ -2024,12 +2030,14 @@ std::vector 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()) {