diff options
author | Andrew <forkk@forkk.net> | 2013-11-11 11:37:15 -0600 |
---|---|---|
committer | Andrew <forkk@forkk.net> | 2013-11-11 11:37:15 -0600 |
commit | 950088bee5d66b3656ba9506d7e4f9b61def5f49 (patch) | |
tree | 895e74767b71f5907d006ce01f47ea7d1e0f97ff /logic | |
parent | 5083a6a8090fa03d3c1800c1f9588079ca11e9f9 (diff) | |
parent | e611aef0e77f727d0c77f6dea0d373e7a12b241c (diff) | |
download | MultiMC-950088bee5d66b3656ba9506d7e4f9b61def5f49.tar MultiMC-950088bee5d66b3656ba9506d7e4f9b61def5f49.tar.gz MultiMC-950088bee5d66b3656ba9506d7e4f9b61def5f49.tar.lz MultiMC-950088bee5d66b3656ba9506d7e4f9b61def5f49.tar.xz MultiMC-950088bee5d66b3656ba9506d7e4f9b61def5f49.zip |
Merge branch 'develop' of github.com:MultiMC/MultiMC5 into develop
Diffstat (limited to 'logic')
-rw-r--r-- | logic/LegacyUpdate.cpp | 7 | ||||
-rw-r--r-- | logic/Mod.cpp | 36 | ||||
-rw-r--r-- | logic/lists/InstanceList.cpp | 22 | ||||
-rw-r--r-- | logic/lists/LwjglVersionList.cpp | 11 |
4 files changed, 41 insertions, 35 deletions
diff --git a/logic/LegacyUpdate.cpp b/logic/LegacyUpdate.cpp index 9533f8ff..8ba97827 100644 --- a/logic/LegacyUpdate.cpp +++ b/logic/LegacyUpdate.cpp @@ -40,7 +40,7 @@ void LegacyUpdate::lwjglStart() LegacyInstance *inst = (LegacyInstance *)m_inst; lwjglVersion = inst->lwjglVersion(); - lwjglTargetPath = PathCombine("lwjgl", lwjglVersion); + lwjglTargetPath = PathCombine(MMC->settings()->get("LWJGLDir").toString(), lwjglVersion); lwjglNativesPath = PathCombine(lwjglTargetPath, "natives"); // if the 'done' file exists, we don't have to download this again @@ -361,7 +361,10 @@ void LegacyUpdate::ModTheJar() setStatus("Installing mods - backing up minecraft.jar..."); if (!baseJar.exists() && !QFile::copy(runnableJar.filePath(), baseJar.filePath())) { - emitFailed("Failed to back up minecraft.jar"); + emitFailed("It seems both the active and base jar are gone. A fresh base jar will be used on next run."); + inst->setShouldRebuild(true); + inst->setShouldUpdate(true); + inst->setShouldUseCustomBaseJar(false); return; } } diff --git a/logic/Mod.cpp b/logic/Mod.cpp index f9647eea..cff9467e 100644 --- a/logic/Mod.cpp +++ b/logic/Mod.cpp @@ -56,34 +56,34 @@ void Mod::repath(const QFileInfo &file) return; QuaZipFile file(&zip); - for (bool more = zip.goToFirstFile(); more; more = zip.goToNextFile()) + + if (zip.setCurrentFile("mcmod.info")) { - QString name = zip.getCurrentFileName(); - if (name == "mcmod.info") + if(!file.open(QIODevice::ReadOnly)) { - if (!file.open(QIODevice::ReadOnly)) - { - zip.close(); - return; - } - ReadMCModInfo(file.readAll()); - file.close(); zip.close(); return; } - else if (name == "forgeversion.properties") + + ReadMCModInfo(file.readAll()); + file.close(); + zip.close(); + return; + } + else if (zip.setCurrentFile("forgeversion.properties")) + { + if (!file.open(QIODevice::ReadOnly)) { - if (!file.open(QIODevice::ReadOnly)) - { - zip.close(); - return; - } - ReadForgeInfo(file.readAll()); - file.close(); zip.close(); return; } + + ReadForgeInfo(file.readAll()); + file.close(); + zip.close(); + return; } + zip.close(); } else if (m_type == MOD_FOLDER) diff --git a/logic/lists/InstanceList.cpp b/logic/lists/InstanceList.cpp index 4446ff22..7081dc6f 100644 --- a/logic/lists/InstanceList.cpp +++ b/logic/lists/InstanceList.cpp @@ -204,7 +204,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // if the root of the json wasn't an object, fail if (!jsonDoc.isObject()) { - qWarning("Invalid group file. Root entry should be an object."); + QLOG_WARN() << "Invalid group file. Root entry should be an object."; return; } @@ -217,7 +217,7 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // Get the groups. if it's not an object, fail if (!rootObj.value("groups").isObject()) { - qWarning("Invalid group list JSON: 'groups' should be an object."); + QLOG_WARN() << "Invalid group list JSON: 'groups' should be an object."; return; } @@ -230,21 +230,21 @@ void InstanceList::loadGroupList(QMap<QString, QString> &groupMap) // If not an object, complain and skip to the next one. if (!iter.value().isObject()) { - qWarning(QString("Group '%1' in the group list should " - "be an object.") - .arg(groupName) - .toUtf8()); + QLOG_WARN() << QString("Group '%1' in the group list should " + "be an object.") + .arg(groupName) + .toUtf8(); continue; } QJsonObject groupObj = iter.value().toObject(); if (!groupObj.value("instances").isArray()) { - qWarning(QString("Group '%1' in the group list is invalid. " - "It should contain an array " - "called 'instances'.") - .arg(groupName) - .toUtf8()); + QLOG_WARN() << QString("Group '%1' in the group list is invalid. " + "It should contain an array " + "called 'instances'.") + .arg(groupName) + .toUtf8(); continue; } diff --git a/logic/lists/LwjglVersionList.cpp b/logic/lists/LwjglVersionList.cpp index 3333e86c..df46d7be 100644 --- a/logic/lists/LwjglVersionList.cpp +++ b/logic/lists/LwjglVersionList.cpp @@ -83,7 +83,10 @@ void LWJGLVersionList::loadList() setLoading(true); auto worker = MMC->qnam(); - reply = worker->get(QNetworkRequest(QUrl(RSS_URL))); + QNetworkRequest req(QUrl(RSS_URL)); + req.setRawHeader("Accept", "text/xml"); + req.setRawHeader("User-Agent", "MultiMC/5.0 (Uncached)"); + reply = worker->get(req); connect(reply, SIGNAL(finished()), SLOT(netRequestComplete())); } @@ -127,7 +130,7 @@ void LWJGLVersionList::netRequestComplete() QDomElement linkElement = getDomElementByTagName(items.at(i).toElement(), "link"); if (linkElement.isNull()) { - qWarning() << "Link element" << i << "in RSS feed doesn't exist! Skipping."; + QLOG_INFO() << "Link element" << i << "in RSS feed doesn't exist! Skipping."; continue; } @@ -143,7 +146,7 @@ void LWJGLVersionList::netRequestComplete() QUrl url(link); if (!url.isValid()) { - qWarning() << "LWJGL version URL isn't valid:" << link << "Skipping."; + QLOG_INFO() << "LWJGL version URL isn't valid:" << link << "Skipping."; continue; } @@ -180,7 +183,7 @@ const PtrLWJGLVersion LWJGLVersionList::getVersion(const QString &versionName) void LWJGLVersionList::failed(QString msg) { - qWarning() << msg; + QLOG_INFO() << msg; emit loadListFailed(msg); } |