summaryrefslogtreecommitdiff
path: root/src/modlist.cpp
diff options
context:
space:
mode:
authorJeremy Rimpo <jeremy.rimpo@servermonkey.com>2025-05-23 14:08:01 -0500
committerGitHub <noreply@github.com>2025-05-23 14:08:01 -0500
commit3a8ea3cccee06397e90305e1e39a305f8b7c3cb3 (patch)
tree6c16bf9825bf3f1613a8536d4702f24667fc4c80 /src/modlist.cpp
parent5d766e94a7a3b3fa861d57d3ad6ae619d98dd5d8 (diff)
Oblivion Remastered Meta PR (#2241)
* Allow for mod directory maps - Set main data files based on game - Mapped mod directories to VFS - Update overwrite setup * Skip if mod contains no 'data' dir * More mod directory compatibility fixes * Workaround for Obl:Rem save location - SLocalSavePath does nothing yet MO2 wants to use it to override the default save location - This only applies to BGS games anyway, we should move this logic * First pass for overwrite mod directory support * More overwrite move / delete restrictions * Fix issue with moving directories that are not required * Formatting pass * More modDataDirectory updates * Formatting --------- Co-authored-by: Mikaƫl Capelle <capelle.mikael@gmail.com>
Diffstat (limited to 'src/modlist.cpp')
-rw-r--r--src/modlist.cpp49
1 files changed, 42 insertions, 7 deletions
diff --git a/src/modlist.cpp b/src/modlist.cpp
index 8945dea1..4ef3afbc 100644
--- a/src/modlist.cpp
+++ b/src/modlist.cpp
@@ -1028,15 +1028,50 @@ bool ModList::dropLocalFiles(const ModListDropInfo& dropInfo, int row,
QList<QPair<QString, QString>> relativePathList;
for (auto localUrl : dropInfo.localUrls()) {
-
QFileInfo sourceInfo(localUrl.url.toLocalFile());
- QString sourceFile = sourceInfo.canonicalFilePath();
+ if (localUrl.originName.compare("overwrite", Qt::CaseInsensitive) == 0) {
+ bool needsMove = true;
+ if (sourceInfo.isDir()) {
+ for (auto dir : m_Organizer->managedGame()->getModMappings().keys()) {
+ QDir overDir(m_Organizer->overwritePath());
+ if (sourceInfo.canonicalFilePath().compare(overDir.absoluteFilePath(dir),
+ Qt::CaseInsensitive) == 0) {
+ needsMove = false;
+
+ QDirIterator dirIter(overDir.absoluteFilePath(dir),
+ QDir::AllDirs | QDir::Files | QDir::NoDotAndDotDot);
+ while (dirIter.hasNext()) {
+ auto entry = dirIter.nextFileInfo();
+ QString sourceFile = entry.canonicalFilePath();
- QFileInfo targetInfo(modDir.absoluteFilePath(localUrl.relativePath));
- sourceList << sourceFile;
- targetList << targetInfo.absoluteFilePath();
- relativePathList << QPair<QString, QString>(localUrl.relativePath,
- localUrl.originName);
+ QFileInfo targetInfo(modDir.absoluteFilePath(
+ overDir.relativeFilePath(entry.absoluteFilePath())));
+ sourceList << sourceFile;
+ targetList << targetInfo.absoluteFilePath();
+ relativePathList << QPair<QString, QString>(localUrl.relativePath,
+ localUrl.originName);
+ }
+ }
+ }
+ }
+ if (needsMove) {
+ QString sourceFile = sourceInfo.canonicalFilePath();
+
+ QFileInfo targetInfo(modDir.absoluteFilePath(localUrl.relativePath));
+ sourceList << sourceFile;
+ targetList << targetInfo.absoluteFilePath();
+ relativePathList << QPair<QString, QString>(localUrl.relativePath,
+ localUrl.originName);
+ }
+ } else {
+ QString sourceFile = sourceInfo.canonicalFilePath();
+
+ QFileInfo targetInfo(modDir.absoluteFilePath(localUrl.relativePath));
+ sourceList << sourceFile;
+ targetList << targetInfo.absoluteFilePath();
+ relativePathList << QPair<QString, QString>(localUrl.relativePath,
+ localUrl.originName);
+ }
}
if (sourceList.count()) {