summaryrefslogtreecommitdiffstats
path: root/api/logic
diff options
context:
space:
mode:
authorJanrupf <werbung.janrupf@t-online.de>2018-03-12 15:09:07 +0100
committerJanrupf <werbung.janrupf@t-online.de>2018-03-12 15:09:07 +0100
commit0812e3a87b2c05a5f9c89d53cda931e6fa71402f (patch)
tree31c5c4f4082206dea5f3155a1cc0b626fad84e87 /api/logic
parentb8ca36372be11b9ddddb3daa3d32583d286f19e2 (diff)
downloadMultiMC-0812e3a87b2c05a5f9c89d53cda931e6fa71402f.tar
MultiMC-0812e3a87b2c05a5f9c89d53cda931e6fa71402f.tar.gz
MultiMC-0812e3a87b2c05a5f9c89d53cda931e6fa71402f.tar.lz
MultiMC-0812e3a87b2c05a5f9c89d53cda931e6fa71402f.tar.xz
MultiMC-0812e3a87b2c05a5f9c89d53cda931e6fa71402f.zip
NOISSUE Fixed code for PR
Diffstat (limited to 'api/logic')
-rw-r--r--api/logic/modplatform/FtbPackInstallTask.cpp51
1 files changed, 8 insertions, 43 deletions
diff --git a/api/logic/modplatform/FtbPackInstallTask.cpp b/api/logic/modplatform/FtbPackInstallTask.cpp
index 8c0bc70c..530f72ca 100644
--- a/api/logic/modplatform/FtbPackInstallTask.cpp
+++ b/api/logic/modplatform/FtbPackInstallTask.cpp
@@ -7,6 +7,7 @@
#include "settings/INISettingsObject.h"
#include "minecraft/MinecraftInstance.h"
#include "minecraft/ComponentList.h"
+#include "minecraft/GradleSpecifier.h"
FtbPackInstallTask::FtbPackInstallTask(FtbPackDownloader *downloader, SettingsObjectPtr settings,
const QString &stagingPath, const QString &instName, const QString &instIcon, const QString &instGroup) :
@@ -79,7 +80,10 @@ void FtbPackInstallTask::install() {
QDir unzipMcDir(m_stagingPath + "/unzip/minecraft");
if(unzipMcDir.exists()) {
//ok, found minecraft dir, move contents to instance dir
- moveRecursively(m_stagingPath + "/unzip/minecraft", m_stagingPath + "/.minecraft");
+ if(!QDir().rename(m_stagingPath + "/unzip/minecraft", m_stagingPath + "/.minecraft")) {
+ emitFailed(tr("Failed to move unzipped minecraft!"));
+ return;
+ }
}
QString instanceConfigPath = FS::PathCombine(m_stagingPath, "instance.cfg");
@@ -111,13 +115,9 @@ void FtbPackInstallTask::install() {
continue;
}
- //It is always maven like
- //net.minecraftforge:forge:1.7.10-10.13.4.1448-1.7.10:universal => 1.7.10-10.13.4.1448-1.7.10
- QString forgeVersion = nameValue.split(":").at(2);
+ GradleSpecifier forgeVersion(nameValue);
- //1.7.10-10.13.4.1448-1.7.10 => 10.13.4.1448
- forgeVersion = forgeVersion.replace(toInstall.mcVersion, "").replace("-", "");
- components->setComponentVersion("net.minecraftforge", forgeVersion);
+ components->setComponentVersion("net.minecraftforge", forgeVersion.version().replace(toInstall.mcVersion, "").replace("-", ""));
packJson.remove();
fallback = false;
break;
@@ -164,43 +164,8 @@ void FtbPackInstallTask::install() {
emitSucceeded();
}
-bool FtbPackInstallTask::moveRecursively(QString sourceFolder, QString destFolder)
+bool FtbPackInstallTask::abort()
{
- bool success = false;
- QDir sourceDir(sourceFolder);
-
- if(!sourceDir.exists())
- return false;
-
- QDir destDir(destFolder);
- if(!destDir.exists())
- destDir.mkdir(destFolder);
-
- QStringList files = sourceDir.entryList(QDir::Files);
- for(int i = 0; i< files.count(); i++) {
- QString srcName = sourceFolder + QDir::separator() + files[i];
- QString destName = destFolder + QDir::separator() + files[i];
- success = QFile::copy(srcName, destName);
- if(!success)
- return false;
- QFile::remove(srcName);
- }
-
- files.clear();
- files = sourceDir.entryList(QDir::AllDirs | QDir::NoDotAndDotDot);
- for(int i = 0; i< files.count(); i++)
- {
- QString srcName = sourceFolder + QDir::separator() + files[i];
- QString destName = destFolder + QDir::separator() + files[i];
- success = moveRecursively(srcName, destName);
- if(!success)
- return false;
- }
-
- return QDir(sourceFolder).rmdir(sourceFolder);
-}
-
-bool FtbPackInstallTask::abort() {
if(abortable) {
return m_downloader->getNetJob()->abort();
}