summaryrefslogtreecommitdiffstats
path: root/api/logic/minecraft/onesix/OneSixProfileStrategy.cpp
diff options
context:
space:
mode:
authorPetr Mrázek <peterix@gmail.com>2017-04-17 22:51:30 +0200
committerPetr Mrázek <peterix@gmail.com>2017-04-17 22:51:30 +0200
commitc4c8e99681e14e5d0e82a13cb0631107dedf96ff (patch)
treea40279027b7530b5b8ddf0bbc286d0a33dc18951 /api/logic/minecraft/onesix/OneSixProfileStrategy.cpp
parentfc28aacdea3e7331b0f5f4436e0dac2fd361c390 (diff)
downloadMultiMC-c4c8e99681e14e5d0e82a13cb0631107dedf96ff.tar
MultiMC-c4c8e99681e14e5d0e82a13cb0631107dedf96ff.tar.gz
MultiMC-c4c8e99681e14e5d0e82a13cb0631107dedf96ff.tar.lz
MultiMC-c4c8e99681e14e5d0e82a13cb0631107dedf96ff.tar.xz
MultiMC-c4c8e99681e14e5d0e82a13cb0631107dedf96ff.zip
NOISSUE jar mods as libraries, fix for customizing net.minecraft
Diffstat (limited to 'api/logic/minecraft/onesix/OneSixProfileStrategy.cpp')
-rw-r--r--api/logic/minecraft/onesix/OneSixProfileStrategy.cpp24
1 files changed, 16 insertions, 8 deletions
diff --git a/api/logic/minecraft/onesix/OneSixProfileStrategy.cpp b/api/logic/minecraft/onesix/OneSixProfileStrategy.cpp
index d3e137c7..b4be3356 100644
--- a/api/logic/minecraft/onesix/OneSixProfileStrategy.cpp
+++ b/api/logic/minecraft/onesix/OneSixProfileStrategy.cpp
@@ -248,16 +248,22 @@ bool OneSixProfileStrategy::removePatch(ProfilePatchPtr patch)
m_instance->setComponentVersion(patch->getID(), QString());
}
- auto preRemoveJarMod = [&](JarmodPtr jarMod) -> bool
+ // FIXME: we need a generic way of removing local resources, not just jar mods...
+ auto preRemoveJarMod = [&](LibraryPtr jarMod) -> bool
{
- QString fullpath = FS::PathCombine(m_instance->jarModsDir(), jarMod->name);
- QFileInfo finfo (fullpath);
+ if (!jarMod->isLocal())
+ {
+ return true;
+ }
+ QStringList jar, temp1, temp2, temp3;
+ jarMod->getApplicableFiles(currentSystem, jar, temp1, temp2, temp3, m_instance->jarmodsPath().absolutePath());
+ QFileInfo finfo (jar[0]);
if(finfo.exists())
{
- QFile jarModFile(fullpath);
+ QFile jarModFile(jar[0]);
if(!jarModFile.remove())
{
- qCritical() << "File" << fullpath << "could not be removed because:" << jarModFile.errorString();
+ qCritical() << "File" << jar[0] << "could not be removed because:" << jarModFile.errorString();
return false;
}
return true;
@@ -381,9 +387,11 @@ bool OneSixProfileStrategy::installJarMods(QStringList filepaths)
}
auto f = std::make_shared<VersionFile>();
- auto jarMod = std::make_shared<Jarmod>();
- jarMod->name = target_filename;
- jarMod->originalName = sourceInfo.completeBaseName();
+ auto jarMod = std::make_shared<Library>();
+ jarMod->setRawName(GradleSpecifier("org.multimc.jarmods:" + id + ":1"));
+ jarMod->setFilename(target_filename);
+ jarMod->setDisplayName(sourceInfo.completeBaseName());
+ jarMod->setHint("local");
f->jarMods.append(jarMod);
f->name = target_name;
f->uid = target_id;