diff options
author | Petr Mrázek <peterix@gmail.com> | 2015-07-10 00:06:05 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2015-07-10 00:06:05 +0200 |
commit | 5dd48e89f5a7facf8355641d0caf8deaec2a03ec (patch) | |
tree | b23f1d3bdb09afe8f642e07df30f5a68f2b42a5e /logic/minecraft/LegacyUpdate.cpp | |
parent | 5133b0f34f1e6fc046787e7369b403a381a2f60c (diff) | |
download | MultiMC-5dd48e89f5a7facf8355641d0caf8deaec2a03ec.tar MultiMC-5dd48e89f5a7facf8355641d0caf8deaec2a03ec.tar.gz MultiMC-5dd48e89f5a7facf8355641d0caf8deaec2a03ec.tar.lz MultiMC-5dd48e89f5a7facf8355641d0caf8deaec2a03ec.tar.xz MultiMC-5dd48e89f5a7facf8355641d0caf8deaec2a03ec.zip |
GH-1034 do jar modding separate from update
Diffstat (limited to 'logic/minecraft/LegacyUpdate.cpp')
-rw-r--r-- | logic/minecraft/LegacyUpdate.cpp | 74 |
1 files changed, 2 insertions, 72 deletions
diff --git a/logic/minecraft/LegacyUpdate.cpp b/logic/minecraft/LegacyUpdate.cpp index 78f2f5b7..7ea20ad8 100644 --- a/logic/minecraft/LegacyUpdate.cpp +++ b/logic/minecraft/LegacyUpdate.cpp @@ -349,7 +349,7 @@ void LegacyUpdate::jarStart() LegacyInstance *inst = (LegacyInstance *)m_inst; if (!inst->shouldUpdate() || inst->shouldUseCustomBaseJar()) { - ModTheJar(); + emitSucceeded(); return; } @@ -384,7 +384,7 @@ void LegacyUpdate::jarStart() void LegacyUpdate::jarFinished() { // process the jar - ModTheJar(); + emitSucceeded(); } void LegacyUpdate::jarFailed(QString reason) @@ -392,73 +392,3 @@ void LegacyUpdate::jarFailed(QString reason) // bad, bad emitFailed(tr("Failed to download the minecraft jar: %1.").arg(reason)); } - -void LegacyUpdate::ModTheJar() -{ - LegacyInstance *inst = (LegacyInstance *)m_inst; - - if (!inst->shouldRebuild()) - { - emitSucceeded(); - return; - } - - // Get the mod list - auto modList = inst->getJarMods(); - - QFileInfo runnableJar(inst->runnableJar()); - QFileInfo baseJar(inst->baseJar()); - bool base_is_custom = inst->shouldUseCustomBaseJar(); - - // Nothing to do if there are no jar mods to install, no backup and just the mc jar - if (base_is_custom) - { - // yes, this can happen if the instance only has the runnable jar and not the base jar - // it *could* be assumed that such an instance is vanilla, but that wouldn't be safe - // because that's not something mmc4 guarantees - if (runnableJar.isFile() && !baseJar.exists() && modList.empty()) - { - inst->setShouldRebuild(false); - emitSucceeded(); - return; - } - - setStatus(tr("Installing mods: Backing up minecraft.jar ...")); - if (!baseJar.exists() && !QFile::copy(runnableJar.filePath(), baseJar.filePath())) - { - 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; - } - } - - if (!baseJar.exists()) - { - emitFailed("The base jar " + baseJar.filePath() + " does not exist"); - return; - } - - if (runnableJar.exists() && !QFile::remove(runnableJar.filePath())) - { - emitFailed("Failed to delete old minecraft.jar"); - return; - } - - setStatus(tr("Installing mods: Opening minecraft.jar ...")); - - QString outputJarPath = runnableJar.filePath(); - QString inputJarPath = baseJar.filePath(); - - if(!MMCZip::createModdedJar(inputJarPath, outputJarPath, modList)) - { - emitFailed(tr("Failed to create the custom Minecraft jar file.")); - return; - } - inst->setShouldRebuild(false); - // inst->UpdateVersion(true); - emitSucceeded(); - return; -} |