diff options
| author | Jeremy Rimpo <jeremy.rimpo@servermonkey.com> | 2024-06-22 01:31:26 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-06-22 08:31:26 +0200 |
| commit | a4f6298111b9b4518d00e6df3a53dd176858dd34 (patch) | |
| tree | 11d35c88a96c6998eac9b7debb8736ebe907d014 /src/modinfoforeign.cpp | |
| parent | d3b647ab2b19626b2f86b5c2af3946c1fcf22068 (diff) | |
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
Diffstat (limited to 'src/modinfoforeign.cpp')
| -rw-r--r-- | src/modinfoforeign.cpp | 18 |
1 files changed, 10 insertions, 8 deletions
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 <QApplication> @@ -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<IPluginGame*>(); - return game->dataDirectory().absolutePath(); -} - std::vector<ModInfo::EFlag> ModInfoForeign::getFlags() const { std::vector<ModInfo::EFlag> 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<QDir> 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; |
