summaryrefslogtreecommitdiffstats
path: root/gui
diff options
context:
space:
mode:
authorJan Dalheimer <jan@dalheimer.de>2014-02-01 16:26:38 +0100
committerJan Dalheimer <jan@dalheimer.de>2014-02-01 16:26:38 +0100
commit8637cce4333aaf56a231d5fab866b0e770436783 (patch)
treef042ed07c09b32a3f5c2b881f2517499cf5b785b /gui
parent4a9e213238234b03fdd994143726a3f75290fc26 (diff)
downloadMultiMC-8637cce4333aaf56a231d5fab866b0e770436783.tar
MultiMC-8637cce4333aaf56a231d5fab866b0e770436783.tar.gz
MultiMC-8637cce4333aaf56a231d5fab866b0e770436783.tar.lz
MultiMC-8637cce4333aaf56a231d5fab866b0e770436783.tar.xz
MultiMC-8637cce4333aaf56a231d5fab866b0e770436783.zip
Fix a bug
Diffstat (limited to 'gui')
-rw-r--r--gui/dialogs/OneSixModEditDialog.cpp15
1 files changed, 12 insertions, 3 deletions
diff --git a/gui/dialogs/OneSixModEditDialog.cpp b/gui/dialogs/OneSixModEditDialog.cpp
index a34409f5..ebd685e8 100644
--- a/gui/dialogs/OneSixModEditDialog.cpp
+++ b/gui/dialogs/OneSixModEditDialog.cpp
@@ -111,12 +111,21 @@ void OneSixModEditDialog::disableVersionControls()
void OneSixModEditDialog::on_userEditorBtn_clicked()
{
- if (QDir(m_inst->instanceRoot()).exists("user.json"))
+ QDir root(m_inst->instanceRoot());
+ if (!root.exists("user.json"))
{
- if (!MMC->openJsonEditor(m_inst->instanceRoot() + "/user.json"))
+ QFile file(root.absoluteFilePath("user.json"));
+ if (!file.open(QFile::WriteOnly))
{
- QMessageBox::warning(this, tr("Error"), tr("Unable to open user.json, check the settings"));
+ QMessageBox::critical(this, tr("Error"), tr("Couldn't write a skeletion user.json file: %1").arg(file.errorString()));
+ return;
}
+ file.write("{\n}");
+ file.close();
+ }
+ if (!MMC->openJsonEditor(root.absoluteFilePath("user.json")))
+ {
+ QMessageBox::warning(this, tr("Error"), tr("Unable to open user.json, check the settings"));
}
}