diff options
| author | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-09-27 20:06:37 +0200 |
|---|---|---|
| committer | Mikaël Capelle <capelle.mikael@gmail.com> | 2020-09-27 21:24:00 +0200 |
| commit | 37b42df112791f20609784a8f36c65fe828388d9 (patch) | |
| tree | 8c1c8a952356e50dea62db142115058bd2ccc177 /src | |
| parent | 9dbf4d7820963dd61cf6fad1abbe7b3962ea922e (diff) | |
Allow absolute path for ini files.
Diffstat (limited to 'src')
| -rw-r--r-- | src/mainwindow.cpp | 4 | ||||
| -rw-r--r-- | src/profile.cpp | 11 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/mainwindow.cpp b/src/mainwindow.cpp index fb71eca3..9a6b83d1 100644 --- a/src/mainwindow.cpp +++ b/src/mainwindow.cpp @@ -1887,10 +1887,10 @@ QDir MainWindow::currentSavesDir() const return m_OrganizerCore.managedGame()->savesDirectory(); } - QString iniPath = m_OrganizerCore.currentProfile()->localSettingsEnabled() + QDir iniDir = m_OrganizerCore.currentProfile()->localSettingsEnabled() ? m_OrganizerCore.currentProfile()->absolutePath() : m_OrganizerCore.managedGame()->documentsDirectory().absolutePath(); - iniPath += "/" + iniFiles[0]; + QString iniPath = iniDir.absoluteFilePath(iniFiles[0]); wchar_t path[MAX_PATH]; if (::GetPrivateProfileStringW( diff --git a/src/profile.cpp b/src/profile.cpp index 6bf282d0..92f2abce 100644 --- a/src/profile.cpp +++ b/src/profile.cpp @@ -805,9 +805,10 @@ bool Profile::localSettingsEnabled() const if (enabled) { QStringList missingFiles; for (QString file : m_GamePlugin->iniFiles()) { - if (!QFile::exists(m_Directory.filePath(file))) { - log::warn("missing {} in {}", file, m_Directory.path()); - missingFiles << file; + QString fileName = QFileInfo(file).fileName(); + if (!QFile::exists(m_Directory.filePath(fileName))) { + log::warn("missing {} in {}", fileName, m_Directory.path()); + missingFiles << fileName; } } if (!missingFiles.empty()) { @@ -837,7 +838,7 @@ bool Profile::enableLocalSettings(bool enable) if (res == QMessageBox::Yes) { QStringList filesToDelete; for (QString file : m_GamePlugin->iniFiles()) { - filesToDelete << m_Directory.absoluteFilePath(file); + filesToDelete << m_Directory.absoluteFilePath(QFileInfo(file).fileName()); } shellDelete(filesToDelete, true); } else if (res == QMessageBox::No) { @@ -886,7 +887,7 @@ QString Profile::getIniFileName() const if (iniFiles.isEmpty()) return ""; else - return m_Directory.absoluteFilePath(iniFiles[0]); + return m_Directory.absoluteFilePath(QFileInfo(iniFiles[0]).fileName()); } QString Profile::absoluteIniFilePath(QString iniFile) const |
