NOISSUE preserve minecraft.jar while migrating Legacy instances
It can be manually modded. It must be preserved when it's the only jar around.
This commit is contained in:
parent
106155dd62
commit
a1c713811c
@ -44,6 +44,26 @@ LegacyInstance::LegacyInstance(SettingsObjectPtr globalSettings, SettingsObjectP
|
|||||||
settings->registerSetting("CustomBaseJar", "");
|
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
|
QString LegacyInstance::baseJar() const
|
||||||
{
|
{
|
||||||
bool customJar = m_settings->get("UseCustomBaseJar").toBool();
|
bool customJar = m_settings->get("UseCustomBaseJar").toBool();
|
||||||
|
@ -64,6 +64,9 @@ public:
|
|||||||
/// the default custom base jar of this instance
|
/// the default custom base jar of this instance
|
||||||
QString defaultCustomBaseJar() const;
|
QString defaultCustomBaseJar() const;
|
||||||
|
|
||||||
|
// the main jar that we actually want to keep when migrating the instance
|
||||||
|
QString mainJarToPreserve() const;
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* Whether or not custom base jar is used
|
* Whether or not custom base jar is used
|
||||||
*/
|
*/
|
||||||
|
@ -92,10 +92,10 @@ void LegacyUpgradeTask::copyFinished()
|
|||||||
components->buildingFromScratch();
|
components->buildingFromScratch();
|
||||||
components->setComponentVersion("net.minecraft", preferredVersionNumber, true);
|
components->setComponentVersion("net.minecraft", preferredVersionNumber, true);
|
||||||
|
|
||||||
if(legacyInst->shouldUseCustomBaseJar())
|
QString jarPath = legacyInst->mainJarToPreserve();
|
||||||
|
if(!jarPath.isNull())
|
||||||
{
|
{
|
||||||
QString jarPath = legacyInst->customBaseJar();
|
qDebug() << "Preserving base jar! : " << jarPath;
|
||||||
qDebug() << "Base jar is custom! : " << jarPath;
|
|
||||||
// FIXME: handle case when the jar is unreadable?
|
// FIXME: handle case when the jar is unreadable?
|
||||||
// TODO: check the hash, if it's the same as the upstream jar, do not do this
|
// TODO: check the hash, if it's the same as the upstream jar, do not do this
|
||||||
components->installCustomJar(jarPath);
|
components->installCustomJar(jarPath);
|
||||||
|
Loading…
Reference in New Issue
Block a user