Fix a bug

This commit is contained in:
Jan Dalheimer 2014-02-01 16:26:38 +01:00
parent 4a9e213238
commit 8637cce433
4 changed files with 15 additions and 6 deletions

View File

@ -111,13 +111,22 @@ 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::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"));
}
}
}
void OneSixModEditDialog::on_reloadLibrariesBtn_clicked()

View File

@ -206,7 +206,7 @@ bool ForgeInstaller::add(OneSixInstance *to)
}
obj.insert("name", QString("Forge"));
obj.insert("id", id());
obj.insert("fileId", id());
obj.insert("version", m_forgeVersionString);
obj.insert("mcVersion", to->intendedVersionId());

View File

@ -79,7 +79,7 @@ bool LiteLoaderInstaller::add(OneSixInstance *to)
obj.insert("+libraries", libraries);
obj.insert("name", QString("LiteLoader"));
obj.insert("id", id());
obj.insert("fileId", id());
obj.insert("version", to->intendedVersionId());
obj.insert("mcVersion", to->intendedVersionId());

View File

@ -225,7 +225,7 @@ struct VersionFile
}
out.name = root.value("name").toString();
out.fileId = root.value("id").toString();
out.fileId = root.value("fileId").toString();
out.version = root.value("version").toString();
out.mcVersion = root.value("mcVersion").toString();
out.filename = filename;