From a4f6298111b9b4518d00e6df3a53dd176858dd34 Mon Sep 17 00:00:00 2001 From: Jeremy Rimpo Date: Sat, 22 Jun 2024 01:31:26 -0500 Subject: Parse unmanaged file location when creating ModInfoForeign (#2053) * Parse unmanaged file location when creating ModInfoForeign - Fixes issues with secondaryDataDirectories * Revert SF memory address changes - CCC implementation prevents the need to determine core plugin LO by dependency chains * The light flag wins over the medium flag - I had expected the opposite, but apparently the light flag still wins if both are set. This shouldn't really happen but it's possible, even with the CK * Update display to account for multi-flagged plugins - Show both icons, warn if both set --- src/modinfoforeign.cpp | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'src/modinfoforeign.cpp') diff --git a/src/modinfoforeign.cpp b/src/modinfoforeign.cpp index db90aa41..cfc5ab4e 100644 --- a/src/modinfoforeign.cpp +++ b/src/modinfoforeign.cpp @@ -1,6 +1,7 @@ #include "modinfoforeign.h" #include "iplugingame.h" +#include "organizercore.h" #include "utility.h" #include @@ -13,13 +14,6 @@ QDateTime ModInfoForeign::creationTime() const return m_CreationTime; } -QString ModInfoForeign::absolutePath() const -{ - // I ought to store this, it's used elsewhere - IPluginGame const* game = qApp->property("managed_game").value(); - return game->dataDirectory().absolutePath(); -} - std::vector ModInfoForeign::getFlags() const { std::vector result = ModInfoWithConflictInfo::getFlags(); @@ -49,7 +43,15 @@ ModInfoForeign::ModInfoForeign(const QString& modName, const QString& referenceF : ModInfoWithConflictInfo(core), m_ReferenceFile(referenceFile), m_Archives(archives), m_ModType(modType) { - m_CreationTime = QFileInfo(referenceFile).birthTime(); + m_CreationTime = QFileInfo(referenceFile).birthTime(); + IPluginGame const* game = core.managedGame(); + QList directories = {game->dataDirectory()}; + directories.append(game->secondaryDataDirectories().values()); + for (QDir directory : directories) { + if (referenceFile.startsWith(directory.absolutePath(), Qt::CaseInsensitive)) { + m_BaseDirectory = directory.absolutePath(); + } + } switch (modType) { case ModInfo::EModType::MOD_DLC: m_Name = tr("DLC: ") + modName; -- cgit v1.3.1