From a1c713811c5a2f514f7255436cfad836e0cf426b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Petr=20Mr=C3=A1zek?= Date: Fri, 23 Mar 2018 23:38:08 +0100 Subject: NOISSUE preserve minecraft.jar while migrating Legacy instances It can be manually modded. It must be preserved when it's the only jar around. --- api/logic/minecraft/legacy/LegacyInstance.cpp | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'api/logic/minecraft/legacy/LegacyInstance.cpp') diff --git a/api/logic/minecraft/legacy/LegacyInstance.cpp b/api/logic/minecraft/legacy/LegacyInstance.cpp index 6e318458..5338763c 100644 --- a/api/logic/minecraft/legacy/LegacyInstance.cpp +++ b/api/logic/minecraft/legacy/LegacyInstance.cpp @@ -44,6 +44,26 @@ LegacyInstance::LegacyInstance(SettingsObjectPtr globalSettings, SettingsObjectP settings->registerSetting("CustomBaseJar", ""); } +QString LegacyInstance::mainJarToPreserve() const +{ + bool customJar = m_settings->get("UseCustomBaseJar").toBool(); + if(customJar) + { + auto base = baseJar(); + if(QFile::exists(base)) + { + return base; + } + } + auto runnable = runnableJar(); + if(QFile::exists(runnable)) + { + return runnable; + } + return QString(); +} + + QString LegacyInstance::baseJar() const { bool customJar = m_settings->get("UseCustomBaseJar").toBool(); -- cgit v1.2.3