summaryrefslogtreecommitdiffstats
path: root/logic/VersionFinal.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2014-03-31 00:19:43 +0200
committerPetr Mrázek <peterix@gmail.com>2014-03-31 00:19:43 +0200
commit29b00eab311064a6ae1512c3c35144c33e7f8ac3 (patch)
treee4134b1e8c1eeb9b18920097187cbbc7bff207ef /logic/VersionFinal.cpp
parenta3c95d9bcc581d74e3d8bfa6e1d3db0478b209f9 (diff)
downloadMultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar.gz
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar.lz
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.tar.xz
MultiMC-29b00eab311064a6ae1512c3c35144c33e7f8ac3.zip
Fix FTB-related issues0.3.1
Diffstat (limited to 'logic/VersionFinal.cpp')
-rw-r--r--logic/VersionFinal.cpp26
1 files changed, 26 insertions, 0 deletions
diff --git a/logic/VersionFinal.cpp b/logic/VersionFinal.cpp
index ed90c148..10e3ec82 100644
--- a/logic/VersionFinal.cpp
+++ b/logic/VersionFinal.cpp
@@ -70,6 +70,7 @@ bool VersionFinal::canRemove(const int index) const
}
return false;
}
+
bool VersionFinal::remove(const int index)
{
if (canRemove(index) && QFile::remove(versionFiles.at(index)->filename))
@@ -83,6 +84,20 @@ bool VersionFinal::remove(const int index)
return false;
}
+bool VersionFinal::remove(const QString id)
+{
+ int i = 0;
+ for (auto file : versionFiles)
+ {
+ if (file->fileId == id)
+ {
+ return remove(i);
+ }
+ i++;
+ }
+ return false;
+}
+
QString VersionFinal::versionFileId(const int index) const
{
if (index < 0 || index >= versionFiles.size())
@@ -91,6 +106,7 @@ QString VersionFinal::versionFileId(const int index) const
}
return versionFiles.at(index)->fileId;
}
+
VersionFilePtr VersionFinal::versionFile(const QString &id)
{
for (auto file : versionFiles)
@@ -103,6 +119,16 @@ VersionFilePtr VersionFinal::versionFile(const QString &id)
return 0;
}
+bool VersionFinal::hasFtbPack()
+{
+ return versionFile("org.multimc.ftb.pack.json") != nullptr;
+}
+
+bool VersionFinal::removeFtbPack()
+{
+ return remove("org.multimc.ftb.pack.json");
+}
+
QList<std::shared_ptr<OneSixLibrary> > VersionFinal::getActiveNormalLibs()
{
QList<std::shared_ptr<OneSixLibrary> > output;