summaryrefslogtreecommitdiffstats
path: root/api/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-01-10 23:03:00 +0100
committerPetr Mrázek <peterix@gmail.com>2017-01-10 23:03:00 +0100
commit858b490c74d4b560923b1b3896735d0a42c78991 (patch)
treea423f01a3e38cf75a26cab99da23228086cd9281 /api/logic
parent12c3683ec07788bf4be03221b0232b4eae27caba (diff)
downloadMultiMC-858b490c74d4b560923b1b3896735d0a42c78991.tar
MultiMC-858b490c74d4b560923b1b3896735d0a42c78991.tar.gz
MultiMC-858b490c74d4b560923b1b3896735d0a42c78991.tar.lz
MultiMC-858b490c74d4b560923b1b3896735d0a42c78991.tar.xz
MultiMC-858b490c74d4b560923b1b3896735d0a42c78991.zip
GH-1778: Fix placement of modded Minecraft.jar in OneSix instances.
Diffstat (limited to 'api/logic')
-rw-r--r--api/logic/minecraft/MinecraftInstance.cpp5
-rw-r--r--api/logic/minecraft/MinecraftInstance.h3
-rw-r--r--api/logic/minecraft/legacy/LegacyInstance.cpp9
-rw-r--r--api/logic/minecraft/legacy/LegacyInstance.h1
-rw-r--r--api/logic/minecraft/legacy/LegacyUpdate.cpp2
-rw-r--r--api/logic/minecraft/onesix/OneSixInstance.cpp8
6 files changed, 17 insertions, 11 deletions
diff --git a/api/logic/minecraft/MinecraftInstance.cpp b/api/logic/minecraft/MinecraftInstance.cpp
index bcbabb1f..7b1aef1e 100644
--- a/api/logic/minecraft/MinecraftInstance.cpp
+++ b/api/logic/minecraft/MinecraftInstance.cpp
@@ -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");
diff --git a/api/logic/minecraft/MinecraftInstance.h b/api/logic/minecraft/MinecraftInstance.h
index 8bae17d5..7f967ce0 100644
--- a/api/logic/minecraft/MinecraftInstance.h
+++ b/api/logic/minecraft/MinecraftInstance.h
@@ -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
{
diff --git a/api/logic/minecraft/legacy/LegacyInstance.cpp b/api/logic/minecraft/legacy/LegacyInstance.cpp
index 85de559c..0987d56f 100644
--- a/api/logic/minecraft/legacy/LegacyInstance.cpp
+++ b/api/logic/minecraft/legacy/LegacyInstance.cpp
@@ -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
diff --git a/api/logic/minecraft/legacy/LegacyInstance.h b/api/logic/minecraft/legacy/LegacyInstance.h
index 6dc11aec..15d1383f 100644
--- a/api/logic/minecraft/legacy/LegacyInstance.h
+++ b/api/logic/minecraft/legacy/LegacyInstance.h
@@ -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;
diff --git a/api/logic/minecraft/legacy/LegacyUpdate.cpp b/api/logic/minecraft/legacy/LegacyUpdate.cpp
index 4ba7f102..fbef47f5 100644
--- a/api/logic/minecraft/legacy/LegacyUpdate.cpp
+++ b/api/logic/minecraft/legacy/LegacyUpdate.cpp
@@ -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.");
diff --git a/api/logic/minecraft/onesix/OneSixInstance.cpp b/api/logic/minecraft/onesix/OneSixInstance.cpp
index 1bc0eb77..b471ff3e 100644
--- a/api/logic/minecraft/onesix/OneSixInstance.cpp
+++ b/api/logic/minecraft/onesix/OneSixInstance.cpp
@@ -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())
{