diff --git a/apps/launcher/maindialog.cpp b/apps/launcher/maindialog.cpp
index 77526677b8..c03a31fd59 100644
--- a/apps/launcher/maindialog.cpp
+++ b/apps/launcher/maindialog.cpp
@@ -180,7 +180,7 @@ bool MainDialog::showFirstRunDialog()
if (msgBox.clickedButton() == importerButton) {
- QString iniPath;
+ QStringList iniPaths;
foreach (const QString &path, mGameSettings.getDataDirs()) {
QDir dir(path);
@@ -190,10 +190,10 @@ bool MainDialog::showFirstRunDialog()
continue; // Cannot move from Data Files
if (dir.exists(QString("Morrowind.ini")))
- iniPath = dir.absoluteFilePath(QString("Morrowind.ini"));
+ iniPaths.append(dir.absoluteFilePath(QString("Morrowind.ini")));
}
- if (iniPath.isEmpty()) {
+ if (iniPaths.isEmpty()) {
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error reading Morrowind configuration file"));
msgBox.setIcon(QMessageBox::Warning);
@@ -205,6 +205,21 @@ bool MainDialog::showFirstRunDialog()
return false;
}
+ if (iniPaths.count() > 1) {
+ // Multiple Morrowind.ini files found
+ bool ok;
+ QString path = QInputDialog::getItem(this, tr("Multiple configurations found"),
+ tr("
There are multiple Morrowind.ini files found.
\
+ Please select the one you wish to import from:"), iniPaths, 0, false, &ok);
+ if (ok && !path.isEmpty()) {
+ iniPaths.clear();
+ iniPaths.append(path);
+ } else {
+ // Cancel was clicked TODO: should we abort here?
+ return false;
+ }
+ }
+
// Create the file if it doesn't already exist, else the importer will fail
QString path = QString::fromStdString(mCfgMgr.getUserPath().string()) + QString("openmw.cfg");
QFile file(path);
@@ -232,7 +247,7 @@ bool MainDialog::showFirstRunDialog()
if (msgBox.isChecked())
arguments.append(QString("-g"));
- arguments.append(iniPath);
+ arguments.append(iniPaths.first());
arguments.append(path);
if (!startProgram(QString("mwiniimport"), arguments, false))
diff --git a/apps/launcher/settings/gamesettings.cpp b/apps/launcher/settings/gamesettings.cpp
index 20ccebc97c..6b46a5160b 100644
--- a/apps/launcher/settings/gamesettings.cpp
+++ b/apps/launcher/settings/gamesettings.cpp
@@ -21,11 +21,10 @@ GameSettings::~GameSettings()
void GameSettings::validatePaths()
{
- if (mSettings.isEmpty())
- return;
+ if (mSettings.isEmpty() || !mDataDirs.isEmpty())
+ return; // Don't re-validate paths if they are already parsed
QStringList paths = mSettings.values(QString("data"));
- qDebug() << "paths " << paths;
Files::PathContainer dataDirs;
foreach (const QString &path, paths) {
@@ -89,19 +88,6 @@ bool GameSettings::readFile(QTextStream &stream)
QString key = keyRe.cap(1).simplified();
QString value = keyRe.cap(2).simplified();
-// // There can be multiple keys
-// if (key == QLatin1String("data") ||
-// key == QLatin1String("master") ||
-// key == QLatin1String("plugin"))
-// {
-// // Remove keys from previous config and overwrite them
-// mSettings.remove(key);
-// QStringList values = cache.values(key);
-// if (!values.contains(value)) // Do not insert duplicate values
-// cache.insertMulti(key, value);
-// } else {
-// cache.insert(key, value);
-// }
mSettings.remove(key);
QStringList values = cache.values(key);