summaryrefslogtreecommitdiffstats
path: root/logic
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2013-08-28 21:52:19 +0200
committerPetr Mrázek <peterix@gmail.com>2013-08-28 21:52:19 +0200
commit78e278c1e33e39eb29a26a976b19ea6a8150bfff (patch)
tree05c9c5a591b706d086930105b0e187e6266f0bb4 /logic
parent93bb7c87e3274124465f0858c20091784f84edb1 (diff)
downloadMultiMC-78e278c1e33e39eb29a26a976b19ea6a8150bfff.tar
MultiMC-78e278c1e33e39eb29a26a976b19ea6a8150bfff.tar.gz
MultiMC-78e278c1e33e39eb29a26a976b19ea6a8150bfff.tar.lz
MultiMC-78e278c1e33e39eb29a26a976b19ea6a8150bfff.tar.xz
MultiMC-78e278c1e33e39eb29a26a976b19ea6a8150bfff.zip
Misc tweaks
* Do not nuke forge META-INF * Disable inner DnD in mod lists on linux.
Diffstat (limited to 'logic')
-rw-r--r--logic/LegacyUpdate.cpp17
-rw-r--r--logic/LegacyUpdate.h7
2 files changed, 19 insertions, 5 deletions
diff --git a/logic/LegacyUpdate.cpp b/logic/LegacyUpdate.cpp
index e259a674..fa93ab8f 100644
--- a/logic/LegacyUpdate.cpp
+++ b/logic/LegacyUpdate.cpp
@@ -250,7 +250,7 @@ void LegacyUpdate::jarFailed()
emitFailed("Failed to download the minecraft jar. Try again later.");
}
-bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >& contained )
+bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >& contained, MetainfAction metainf )
{
setStatus("Installing mods - Adding " + from.fileName());
@@ -262,15 +262,22 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
for(bool more=modZip.goToFirstFile(); more; more=modZip.goToNextFile())
{
QString filename = modZip.getCurrentFileName();
- if(filename.contains("META-INF"))
+ if(filename.contains("META-INF") && metainf == LegacyUpdate::IgnoreMetainf)
+ {
+ qDebug() << "Skipping META-INF " << filename << " from " << from.fileName();
continue;
+ }
if(contained.contains(filename))
+ {
+ qDebug() << "Skipping already contained file " << filename << " from " << from.fileName();
continue;
+ }
contained.insert(filename);
qDebug() << "Adding file " << filename << " from " << from.fileName();
if(!fileInsideMod.open(QIODevice::ReadOnly))
{
+ qDebug() << "Failed to open " << filename << " from " << from.fileName();
return false;
}
/*
@@ -283,6 +290,7 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
*/
if(!zipOutFile.open(QIODevice::WriteOnly, info_out))
{
+ qDebug() << "Failed to open " << filename << " in the jar";
fileInsideMod.close();
return false;
}
@@ -290,6 +298,7 @@ bool LegacyUpdate::MergeZipFiles( QuaZip* into, QFileInfo from, QSet< QString >&
{
zipOutFile.close();
fileInsideMod.close();
+ qDebug() << "Failed to copy data of " << filename << " into the jar";
return false;
}
zipOutFile.close();
@@ -369,7 +378,7 @@ void LegacyUpdate::ModTheJar()
auto &mod = modList->operator[](i);
if (mod.type() == Mod::MOD_ZIPFILE)
{
- if(!MergeZipFiles(&zipOut, mod.filename(), addedFiles))
+ if(!MergeZipFiles(&zipOut, mod.filename(), addedFiles, LegacyUpdate::KeepMetainf))
{
zipOut.close();
QFile::remove(runnableJar.filePath());
@@ -408,7 +417,7 @@ void LegacyUpdate::ModTheJar()
}
}
- if(!MergeZipFiles(&zipOut, baseJar, addedFiles))
+ if(!MergeZipFiles(&zipOut, baseJar, addedFiles, LegacyUpdate::IgnoreMetainf))
{
zipOut.close();
QFile::remove(runnableJar.filePath());
diff --git a/logic/LegacyUpdate.h b/logic/LegacyUpdate.h
index a68d67bb..c94fc4c6 100644
--- a/logic/LegacyUpdate.h
+++ b/logic/LegacyUpdate.h
@@ -48,7 +48,12 @@ private slots:
void ModTheJar();
private:
- bool MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString>& contained);
+ enum MetainfAction
+ {
+ KeepMetainf, // the META-INF folder will be added from the merged jar
+ IgnoreMetainf // the META-INF from the merged jar will be ignored
+ };
+ bool MergeZipFiles(QuaZip *into, QFileInfo from, QSet<QString>& contained, MetainfAction metainf);
private:
QSharedPointer<QNetworkReply> m_reply;