GH-1778: Fix placement of modded Minecraft.jar in OneSix instances.

This commit is contained in:
Petr Mrázek 2017-01-10 23:03:00 +01:00
parent 12c3683ec0
commit 858b490c74
7 changed files with 21 additions and 11 deletions

View File

@ -97,6 +97,11 @@ QString MinecraftInstance::minecraftRoot() const
return mcDir.filePath();
}
QString MinecraftInstance::binRoot() const
{
return FS::PathCombine(minecraftRoot(), "bin");
}
std::shared_ptr< BaseVersionList > MinecraftInstance::versionList() const
{
return ENV.getVersionList("net.minecraft");

View File

@ -19,6 +19,9 @@ public:
/// Path to the instance's minecraft directory.
QString minecraftRoot() const;
/// Path to the instance's minecraft/bin directory.
QString binRoot() const;
////// Mod Lists //////
virtual std::shared_ptr<ModList> resourcePackList() const
{

View File

@ -291,11 +291,6 @@ QString LegacyInstance::jarModsDir() const
return FS::PathCombine(instanceRoot(), "instMods");
}
QString LegacyInstance::binDir() const
{
return FS::PathCombine(minecraftRoot(), "bin");
}
QString LegacyInstance::libDir() const
{
return FS::PathCombine(minecraftRoot(), "lib");
@ -327,7 +322,7 @@ QString LegacyInstance::texturePacksDir() const
QString LegacyInstance::runnableJar() const
{
return FS::PathCombine(binDir(), "minecraft.jar");
return FS::PathCombine(binRoot(), "minecraft.jar");
}
QString LegacyInstance::modListFile() const
@ -399,7 +394,7 @@ QString LegacyInstance::defaultBaseJar() const
QString LegacyInstance::defaultCustomBaseJar() const
{
return FS::PathCombine(binDir(), "mcbackup.jar");
return FS::PathCombine(binRoot(), "mcbackup.jar");
}
QString LegacyInstance::lwjglFolder() const

View File

@ -57,7 +57,6 @@ public:
QString savesDir() const;
QString texturePacksDir() const;
QString jarModsDir() const;
QString binDir() const;
QString loaderModsDir() const;
QString coreModsDir() const;
QString resourceDir() const;

View File

@ -356,7 +356,7 @@ void LegacyUpdate::jarStart()
setStatus(tr("Checking for jar updates..."));
// Make directories
QDir binDir(inst->binDir());
QDir binDir(inst->binRoot());
if (!binDir.exists() && !binDir.mkpath("."))
{
emitFailed("Failed to create bin folder.");

View File

@ -156,7 +156,7 @@ QString OneSixInstance::mainJarPath() const
auto jarMods = getJarMods();
if (!jarMods.isEmpty())
{
return QDir(instanceRoot()).absoluteFilePath("minecraft.jar");
return QDir(binRoot()).absoluteFilePath("minecraft.jar");
}
else
{
@ -392,7 +392,11 @@ std::shared_ptr<Task> OneSixInstance::createJarModdingTask()
{
tempJar.remove();
}
auto finalJarPath = QDir(m_inst->instanceRoot()).absoluteFilePath("minecraft.jar");
if(!FS::ensureFolderPathExists(m_inst->binRoot()))
{
emitFailed(tr("Couldn't create the bin folder for Minecraft.jar"));
}
auto finalJarPath = QDir(m_inst->binRoot()).absoluteFilePath("minecraft.jar");
QFile finalJar(finalJarPath);
if(finalJar.exists())
{

View File

@ -146,6 +146,10 @@
This fixes launching of legacy (and legacy FTB) instances.
- GH-1778: Jar modded Minecraft.jar location breaks mod assumptions
Some ancient mods require the modded `Minecraft.jar` to be in `.minecraft/bin`, inside the instance. Now it is placed there.
## Internals
- Full support for the current Mojang downloads JSON format.