Write settings before invoking openmw-iniimporter

pull/438/head
tri4ng1e 7 years ago
parent 7e03dd0f12
commit f2613a74b1
No known key found for this signature in database
GPG Key ID: A3E3103F4E24BEA5

@ -231,29 +231,13 @@ void Wizard::MainWizard::setupInstallations()
void Wizard::MainWizard::runSettingsImporter() void Wizard::MainWizard::runSettingsImporter()
{ {
writeSettings();
QString path(field(QLatin1String("installation.path")).toString()); QString path(field(QLatin1String("installation.path")).toString());
// Create the file if it doesn't already exist, else the importer will fail
QString userPath(toQString(mCfgMgr.getUserConfigPath())); QString userPath(toQString(mCfgMgr.getUserConfigPath()));
QFile file(userPath + QLatin1String("openmw.cfg")); QFile file(userPath + QLatin1String("openmw.cfg"));
if (!file.exists()) {
if (!file.open(QIODevice::ReadWrite)) {
// File cannot be created
QMessageBox msgBox;
msgBox.setWindowTitle(tr("Error writing OpenMW configuration file"));
msgBox.setIcon(QMessageBox::Critical);
msgBox.setStandardButtons(QMessageBox::Ok);
msgBox.setText(tr("<html><head/><body><p><b>Could not open or create %1 for writing</b></p> \
<p>Please make sure you have the right permissions \
and try again.</p></body></html>").arg(file.fileName()));
msgBox.exec();
return qApp->quit();
}
file.close();
}
// Construct the arguments to run the importer // Construct the arguments to run the importer
QStringList arguments; QStringList arguments;

Loading…
Cancel
Save