summaryrefslogtreecommitdiff
path: root/src/profile.cpp
diff options
context:
space:
mode:
authorMikaël Capelle <capelle.mikael@gmail.com>2020-09-27 20:31:51 +0200
committerMikaël Capelle <capelle.mikael@gmail.com>2020-09-27 20:31:51 +0200
commitb53dc1e20061be3a8035f10e95b57c4c60bee3c8 (patch)
tree6d9469b9aeb7df2773cb42dfe4214a020aade30e /src/profile.cpp
parent12524354a8aa599612a547f4aa76ec9cd9c5baa7 (diff)
Add IProfile::iniFilePath().
Diffstat (limited to 'src/profile.cpp')
-rw-r--r--src/profile.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/profile.cpp b/src/profile.cpp
index c1e30c22..238454d5 100644
--- a/src/profile.cpp
+++ b/src/profile.cpp
@@ -889,6 +889,31 @@ QString Profile::getIniFileName() const
return m_Directory.absoluteFilePath(iniFiles[0]);
}
+QString Profile::iniFilePath(QString iniFile) const
+{
+ // This is the file to which the given iniFile would be mapped, as
+ // an absolute file path:
+ QString targetIniFile = m_GamePlugin->gameDirectory().absoluteFilePath(iniFile);
+
+ bool isGameIni = false;
+ for (auto gameIni : m_GamePlugin->iniFiles()) {
+ // We compare the target file, not the actual ones:
+ if (m_GamePlugin->gameDirectory().absoluteFilePath(gameIni) == targetIniFile) {
+ isGameIni = true;
+ break;
+ }
+ }
+
+ // Local-settings are not enabled, or the iniFile is not in the list of INI
+ // files for the current game.
+ if (!localSettingsEnabled() || !isGameIni) {
+ return m_GamePlugin->documentsDirectory().absoluteFilePath(iniFile);
+ }
+
+ // If we reach here, the file is in the profile:
+ return m_Directory.absoluteFilePath(QFileInfo(targetIniFile).fileName());
+}
+
QString Profile::getProfileTweaks() const
{
return QDir::cleanPath(m_Directory.absoluteFilePath(ToQString(AppConfig::profileTweakIni())));