diff options
author | Petr Mrázek <peterix@gmail.com> | 2016-10-02 00:26:10 +0200 |
---|---|---|
committer | Petr Mrázek <peterix@gmail.com> | 2016-10-02 00:26:10 +0200 |
commit | 6e80f03409054293bdbbcd0ce87b607a811016d5 (patch) | |
tree | d64d9034d797a9c619cca4bad5ff0ef1dfb73165 /api/logic/minecraft | |
parent | 69f3ab019d4ef9e28d0c7e3c4ce3a609a6ff0a91 (diff) | |
download | MultiMC-6e80f03409054293bdbbcd0ce87b607a811016d5.tar MultiMC-6e80f03409054293bdbbcd0ce87b607a811016d5.tar.gz MultiMC-6e80f03409054293bdbbcd0ce87b607a811016d5.tar.lz MultiMC-6e80f03409054293bdbbcd0ce87b607a811016d5.tar.xz MultiMC-6e80f03409054293bdbbcd0ce87b607a811016d5.zip |
NOISSUE add instance-local library storage
Any libraries stored in $instanceroot/libraries/ will override
the libraries from MultiMC's global folders, as long as they are marked 'local'
in the json patch.
Diffstat (limited to 'api/logic/minecraft')
-rw-r--r-- | api/logic/minecraft/GradleSpecifier.h | 17 | ||||
-rw-r--r-- | api/logic/minecraft/Library.cpp | 40 | ||||
-rw-r--r-- | api/logic/minecraft/Library.h | 7 | ||||
-rw-r--r-- | api/logic/minecraft/Library_test.cpp | 130 | ||||
-rw-r--r-- | api/logic/minecraft/MinecraftInstance.h | 2 | ||||
-rw-r--r-- | api/logic/minecraft/MinecraftProfile.cpp | 4 | ||||
-rw-r--r-- | api/logic/minecraft/MinecraftProfile.h | 2 | ||||
-rw-r--r-- | api/logic/minecraft/legacy/LegacyInstance.h | 5 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/OneSixInstance.cpp | 14 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/OneSixInstance.h | 2 | ||||
-rw-r--r-- | api/logic/minecraft/onesix/update/LibrariesTask.cpp | 2 | ||||
-rw-r--r-- | api/logic/minecraft/testdata/codecwav-20101023.jar | 1 | ||||
-rw-r--r-- | api/logic/minecraft/testdata/testname-testversion-linux-32.jar | 1 |
13 files changed, 182 insertions, 45 deletions
diff --git a/api/logic/minecraft/GradleSpecifier.h b/api/logic/minecraft/GradleSpecifier.h index 18308537..b05553bb 100644 --- a/api/logic/minecraft/GradleSpecifier.h +++ b/api/logic/minecraft/GradleSpecifier.h @@ -55,18 +55,23 @@ struct GradleSpecifier } return retval; } + QString getFileName() const + { + QString filename = m_artifactId + '-' + m_version; + if(!m_classifier.isEmpty()) + { + filename += "-" + m_classifier; + } + filename += "." + m_extension; + return filename; + } QString toPath() const { if(!m_valid) return "INVALID"; QString path = m_groupId; path.replace('.', '/'); - path += '/' + m_artifactId + '/' + m_version + '/' + m_artifactId + '-' + m_version; - if(!m_classifier.isEmpty()) - { - path += "-" + m_classifier; - } - path += "." + m_extension; + path += '/' + m_artifactId + '/' + m_version + '/' + getFileName(); return path; } inline bool valid() const diff --git a/api/logic/minecraft/Library.cpp b/api/logic/minecraft/Library.cpp index c516edb7..8bbd5503 100644 --- a/api/logic/minecraft/Library.cpp +++ b/api/logic/minecraft/Library.cpp @@ -1,15 +1,31 @@ #include "Library.h" +#include "MinecraftInstance.h" + #include <net/Download.h> #include <net/ChecksumValidator.h> #include <minecraft/forge/ForgeXzDownload.h> #include <Env.h> #include <FileSystem.h> -void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32, QStringList& native64) const + +void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& native, QStringList& native32, + QStringList& native64, const QString &overridePath) const { + bool isLocal = (hint() == "local"); auto actualPath = [&](QString relPath) { QFileInfo out(FS::PathCombine(storagePrefix(), relPath)); + if(isLocal && !overridePath.isEmpty()) + { + QString fileName = out.fileName(); + auto fullPath = FS::PathCombine(overridePath, fileName); + qDebug() << fullPath; + QFileInfo fileinfo(fullPath); + if(fileinfo.exists()) + { + return fileinfo.absoluteFilePath(); + } + } return out.absoluteFilePath(); }; if(m_mojangDownloads) @@ -69,7 +85,8 @@ void Library::getApplicableFiles(OpSys system, QStringList& jar, QStringList& na } } -QList<NetActionPtr> Library::getDownloads(OpSys system, HttpMetaCache * cache, QStringList &failedFiles) const +QList< std::shared_ptr< NetAction > > Library::getDownloads(OpSys system, class HttpMetaCache* cache, + QStringList& failedFiles, const QString & overridePath) const { QList<NetActionPtr> out; bool isAlwaysStale = (hint() == "always-stale"); @@ -87,6 +104,25 @@ QList<NetActionPtr> Library::getDownloads(OpSys system, HttpMetaCache * cache, Q return true; if(isLocal) { + if(!overridePath.isEmpty()) + { + QString fileName; + int position = storage.lastIndexOf('/'); + if(position == -1) + { + fileName = storage; + } + else + { + fileName = storage.mid(position); + } + auto fullPath = FS::PathCombine(overridePath, fileName); + QFileInfo fileinfo(fullPath); + if(fileinfo.exists()) + { + return true; + } + } QFileInfo fileinfo(entry->getFullPath()); if(!fileinfo.exists()) { diff --git a/api/logic/minecraft/Library.h b/api/logic/minecraft/Library.h index fdce93f3..6369c537 100644 --- a/api/logic/minecraft/Library.h +++ b/api/logic/minecraft/Library.h @@ -18,6 +18,7 @@ #include "multimc_logic_export.h" class Library; +class MinecraftInstance; typedef std::shared_ptr<Library> LibraryPtr; @@ -99,7 +100,8 @@ public: /* methods */ m_repositoryURL = base_url; } - void getApplicableFiles(OpSys system, QStringList & jar, QStringList & native, QStringList & native32, QStringList & native64) const; + void getApplicableFiles(OpSys system, QStringList & jar, QStringList & native, + QStringList & native32, QStringList & native64, const QString & overridePath) const; void setAbsoluteUrl(const QString &absolute_url) { @@ -126,7 +128,8 @@ public: /* methods */ bool isActive() const; // Get a list of downloads for this library - QList<NetActionPtr> getDownloads(OpSys system, class HttpMetaCache * cache, QStringList &failedFiles) const; + QList<NetActionPtr> getDownloads(OpSys system, class HttpMetaCache * cache, + QStringList & failedFiles, const QString & overridePath) const; private: /* methods */ /// the default storage prefix used by MultiMC diff --git a/api/logic/minecraft/Library_test.cpp b/api/logic/minecraft/Library_test.cpp index fcf0b4d1..fe61d305 100644 --- a/api/logic/minecraft/Library_test.cpp +++ b/api/logic/minecraft/Library_test.cpp @@ -31,6 +31,7 @@ slots: { cache.reset(new HttpMetaCache()); cache->addBase("libraries", QDir("libraries").absolutePath()); + dataDir = QDir("data").absolutePath(); } void test_legacy() { @@ -39,7 +40,7 @@ slots: QCOMPARE(test.isNative(), false); QStringList jar, native, native32, native64; - test.getApplicableFiles(currentSystem, jar, native, native32, native64); + test.getApplicableFiles(currentSystem, jar, native, native32, native64, QString()); QCOMPARE(jar, getStorage("test/package/testname/testversion/testname-testversion.jar")); QCOMPARE(native, {}); QCOMPARE(native32, {}); @@ -50,7 +51,7 @@ slots: QStringList failedFiles; Library test("test.package:testname:testversion"); test.setRepositoryURL("file://foo/bar"); - auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles); + auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QString()); QCOMPARE(downloads.size(), 1); QCOMPARE(failedFiles, {}); NetActionPtr dl = downloads[0]; @@ -62,10 +63,27 @@ slots: QCOMPARE(test.isNative(), false); QStringList failedFiles; test.setHint("local"); - auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles); + auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QString()); QCOMPARE(downloads.size(), 0); QCOMPARE(failedFiles, getStorage("test/package/testname/testversion/testname-testversion.jar")); } + void test_legacy_url_local_override() + { + Library test("com.paulscode:codecwav:20101023"); + QCOMPARE(test.isNative(), false); + QStringList failedFiles; + test.setHint("local"); + auto downloads = test.getDownloads(currentSystem, cache.get(), failedFiles, QString("data")); + QCOMPARE(downloads.size(), 0); + QCOMPARE(failedFiles.size(), 0); + + QStringList jar, native, native32, native64; + test.getApplicableFiles(currentSystem, jar, native, native32, native64, QString("data")); + QCOMPARE(jar, {QFileInfo("data/codecwav-20101023.jar").absoluteFilePath()}); + QCOMPARE(native, {}); + QCOMPARE(native32, {}); + QCOMPARE(native64, {}); + } void test_legacy_native() { Library test("test.package:testname:testversion"); @@ -74,13 +92,13 @@ slots: test.setRepositoryURL("file://foo/bar"); { QStringList jar, native, native32, native64; - test.getApplicableFiles(Os_Linux, jar, native, native32, native64); + test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QString()); QCOMPARE(jar, {}); QCOMPARE(native, getStorage("test/package/testname/testversion/testname-testversion-linux.jar")); QCOMPARE(native32, {}); QCOMPARE(native64, {}); QStringList failedFiles; - auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles); + auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QString()); QCOMPARE(dls.size(), 1); QCOMPARE(failedFiles, {}); auto dl = dls[0]; @@ -97,13 +115,13 @@ slots: test.setRepositoryURL("file://foo/bar"); { QStringList jar, native, native32, native64; - test.getApplicableFiles(Os_Linux, jar, native, native32, native64); + test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QString()); QCOMPARE(jar, {}); QCOMPARE(native, {}); QCOMPARE(native32, getStorage("test/package/testname/testversion/testname-testversion-linux-32.jar")); QCOMPARE(native64, getStorage("test/package/testname/testversion/testname-testversion-linux-64.jar")); QStringList failedFiles; - auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles); + auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QString()); QCOMPARE(dls.size(), 2); QCOMPARE(failedFiles, {}); QCOMPARE(dls[0]->m_url, QUrl("file://foo/bar/test/package/testname/testversion/testname-testversion-linux-32.jar")); @@ -111,13 +129,13 @@ slots: } { QStringList jar, native, native32, native64; - test.getApplicableFiles(Os_Windows, jar, native, native32, native64); + test.getApplicableFiles(Os_Windows, jar, native, native32, native64, QString()); QCOMPARE(jar, {}); QCOMPARE(native, {}); QCOMPARE(native32, getStorage("test/package/testname/testversion/testname-testversion-windows-32.jar")); QCOMPARE(native64, getStorage("test/package/testname/testversion/testname-testversion-windows-64.jar")); QStringList failedFiles; - auto dls = test.getDownloads(Os_Windows, cache.get(), failedFiles); + auto dls = test.getDownloads(Os_Windows, cache.get(), failedFiles, QString()); QCOMPARE(dls.size(), 2); QCOMPARE(failedFiles, {}); QCOMPARE(dls[0]->m_url, QUrl("file://foo/bar/test/package/testname/testversion/testname-testversion-windows-32.jar")); @@ -125,45 +143,103 @@ slots: } { QStringList jar, native, native32, native64; - test.getApplicableFiles(Os_OSX, jar, native, native32, native64); + test.getApplicableFiles(Os_OSX, jar, native, native32, native64, QString()); QCOMPARE(jar, {}); QCOMPARE(native, {}); QCOMPARE(native32, getStorage("test/package/testname/testversion/testname-testversion-osx-32.jar")); QCOMPARE(native64, getStorage("test/package/testname/testversion/testname-testversion-osx-64.jar")); QStringList failedFiles; - auto dls = test.getDownloads(Os_OSX, cache.get(), failedFiles); + auto dls = test.getDownloads(Os_OSX, cache.get(), failedFiles, QString()); QCOMPARE(dls.size(), 2); QCOMPARE(failedFiles, {}); QCOMPARE(dls[0]->m_url, QUrl("file://foo/bar/test/package/testname/testversion/testname-testversion-osx-32.jar")); QCOMPARE(dls[1]->m_url, QUrl("file://foo/bar/test/package/testname/testversion/testname-testversion-osx-64.jar")); } } + void test_legacy_native_arch_local_override() + { + Library test("test.package:testname:testversion"); + test.m_nativeClassifiers[OpSys::Os_Linux]="linux-${arch}"; + test.setHint("local"); + QCOMPARE(test.isNative(), true); + test.setRepositoryURL("file://foo/bar"); + { + QStringList jar, native, native32, native64; + test.getApplicableFiles(Os_Linux, jar, native, native32, native64, QString("data")); + QCOMPARE(jar, {}); + QCOMPARE(native, {}); + QCOMPARE(native32, {QFileInfo("data/testname-testversion-linux-32.jar").absoluteFilePath()}); + QCOMPARE(native64, getStorage("test/package/testname/testversion/testname-testversion-linux-64.jar")); + QStringList failedFiles; + auto dls = test.getDownloads(Os_Linux, cache.get(), failedFiles, QString("data")); + QCOMPARE(dls.size(), 0); + QCOMPARE(failedFiles, {getStorage("test/package/testname/testversion/testname-testversion-linux-64.jar")}); + } + } void test_onenine() { auto test = readMojangJson("data/lib-simple.json"); - QStringList jar, native, native32, native64; - test->getApplicableFiles(Os_OSX, jar, native, native32, native64); - QCOMPARE(jar, getStorage("com/paulscode/codecwav/20101023/codecwav-20101023.jar")); - QCOMPARE(native, {}); - QCOMPARE(native32, {}); - QCOMPARE(native64, {}); - QStringList failedFiles; - auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles); - QCOMPARE(dls.size(), 1); - QCOMPARE(failedFiles, {}); - QCOMPARE(dls[0]->m_url, QUrl("https://libraries.minecraft.net/com/paulscode/codecwav/20101023/codecwav-20101023.jar")); + { + QStringList jar, native, native32, native64; + test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString()); + QCOMPARE(jar, getStorage("com/paulscode/codecwav/20101023/codecwav-20101023.jar")); + QCOMPARE(native, {}); + QCOMPARE(native32, {}); + QCOMPARE(native64, {}); + } + { + QStringList failedFiles; + auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QString()); + QCOMPARE(dls.size(), 1); + QCOMPARE(failedFiles, {}); + QCOMPARE(dls[0]->m_url, QUrl("https://libraries.minecraft.net/com/paulscode/codecwav/20101023/codecwav-20101023.jar")); + } + test->setHint("local"); + { + QStringList jar, native, native32, native64; + test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString("data")); + QCOMPARE(jar, {QFileInfo("data/codecwav-20101023.jar").absoluteFilePath()}); + QCOMPARE(native, {}); + QCOMPARE(native32, {}); + QCOMPARE(native64, {}); + } + { + QStringList failedFiles; + auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QString("data")); + QCOMPARE(dls.size(), 0); + QCOMPARE(failedFiles, {}); + } + } + void test_onenine_local_override() + { + auto test = readMojangJson("data/lib-simple.json"); + test->setHint("local"); + { + QStringList jar, native, native32, native64; + test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString("data")); + QCOMPARE(jar, {QFileInfo("data/codecwav-20101023.jar").absoluteFilePath()}); + QCOMPARE(native, {}); + QCOMPARE(native32, {}); + QCOMPARE(native64, {}); + } + { + QStringList failedFiles; + auto dls = test->getDownloads(Os_Linux, cache.get(), failedFiles, QString("data")); + QCOMPARE(dls.size(), 0); + QCOMPARE(failedFiles, {}); + } } void test_onenine_native() { auto test = readMojangJson("data/lib-native.json"); QStringList jar, native, native32, native64; - test->getApplicableFiles(Os_OSX, jar, native, native32, native64); + test->getApplicableFiles(Os_OSX, jar, native, native32, native64, QString()); QCOMPARE(jar, getStorage("org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar")); QCOMPARE(native, getStorage("org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209-natives-osx.jar")); QCOMPARE(native32, {}); QCOMPARE(native64, {}); QStringList failedFiles; - auto dls = test->getDownloads(Os_OSX, cache.get(), failedFiles); + auto dls = test->getDownloads(Os_OSX, cache.get(), failedFiles, QString()); QCOMPARE(dls.size(), 2); QCOMPARE(failedFiles, {}); QCOMPARE(dls[0]->m_url, QUrl("https://libraries.minecraft.net/org/lwjgl/lwjgl/lwjgl-platform/2.9.4-nightly-20150209/lwjgl-platform-2.9.4-nightly-20150209.jar")); @@ -173,13 +249,13 @@ slots: { auto test = readMojangJson("data/lib-native-arch.json"); QStringList jar, native, native32, native64; - test->getApplicableFiles(Os_Windows, jar, native, native32, native64); + test->getApplicableFiles(Os_Windows, jar, native, native32, native64, QString()); QCOMPARE(jar, {}); QCOMPARE(native, {}); QCOMPARE(native32, getStorage("tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-32.jar")); QCOMPARE(native64, getStorage("tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-64.jar")); QStringList failedFiles; - auto dls = test->getDownloads(Os_Windows, cache.get(), failedFiles); + auto dls = test->getDownloads(Os_Windows, cache.get(), failedFiles, QString()); QCOMPARE(dls.size(), 2); QCOMPARE(failedFiles, {}); QCOMPARE(dls[0]->m_url, QUrl("https://libraries.minecraft.net/tv/twitch/twitch-platform/5.16/twitch-platform-5.16-natives-windows-32.jar")); @@ -187,7 +263,7 @@ slots: } private: std::unique_ptr<HttpMetaCache> cache; - QString workDir; + QString dataDir; }; QTEST_GUILESS_MAIN(LibraryTest) diff --git a/api/logic/minecraft/MinecraftInstance.h b/api/logic/minecraft/MinecraftInstance.h index 3aef2969..8bae17d5 100644 --- a/api/logic/minecraft/MinecraftInstance.h +++ b/api/logic/minecraft/MinecraftInstance.h @@ -69,6 +69,8 @@ public: virtual QString getNativePath() const = 0; + virtual QString getLocalLibraryPath() const = 0; + virtual QStringList processMinecraftArgs(AuthSessionPtr account) const = 0; virtual JavaVersion getJavaVersion() const; diff --git a/api/logic/minecraft/MinecraftProfile.cpp b/api/logic/minecraft/MinecraftProfile.cpp index fbd67875..f6ae7360 100644 --- a/api/logic/minecraft/MinecraftProfile.cpp +++ b/api/logic/minecraft/MinecraftProfile.cpp @@ -581,14 +581,14 @@ const QList<LibraryPtr> & MinecraftProfile::getLibraries() const return m_libraries; } -void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars) const +void MinecraftProfile::getLibraryFiles(const QString& architecture, QStringList& jars, QStringList& nativeJars, const QString& overridePath) const { QStringList native32, native64; jars.clear(); nativeJars.clear(); for (auto lib : getLibraries()) { - lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64); + lib->getApplicableFiles(currentSystem, jars, nativeJars, native32, native64, overridePath); } if(architecture == "32") { diff --git a/api/logic/minecraft/MinecraftProfile.h b/api/logic/minecraft/MinecraftProfile.h index 22dca979..9f5536fb 100644 --- a/api/logic/minecraft/MinecraftProfile.h +++ b/api/logic/minecraft/MinecraftProfile.h @@ -111,7 +111,7 @@ public: /* getters for profile variables */ const QStringList & getTweakers() const; const QList<JarmodPtr> & getJarMods() const; const QList<LibraryPtr> & getLibraries() const; - void getLibraryFiles(const QString & architecture, QStringList & jars, QStringList & nativeJars) const; + void getLibraryFiles(const QString & architecture, QStringList & jars, QStringList & nativeJars, const QString & overridePath) const; QString getMainJarUrl() const; bool hasTrait(const QString & trait) const; ProblemSeverity getProblemSeverity() const; diff --git a/api/logic/minecraft/legacy/LegacyInstance.h b/api/logic/minecraft/legacy/LegacyInstance.h index 1d95340b..3db35fc9 100644 --- a/api/logic/minecraft/legacy/LegacyInstance.h +++ b/api/logic/minecraft/legacy/LegacyInstance.h @@ -132,6 +132,11 @@ public: QStringList getNativeJars() const override; QString getNativePath() const override; + QString getLocalLibraryPath() const override + { + return QString(); + } + QStringList processMinecraftArgs(AuthSessionPtr account) const override; QStringList verboseDescription(AuthSessionPtr session) override; diff --git a/api/logic/minecraft/onesix/OneSixInstance.cpp b/api/logic/minecraft/onesix/OneSixInstance.cpp index 1bf75bdb..d89a7612 100644 --- a/api/logic/minecraft/onesix/OneSixInstance.cpp +++ b/api/logic/minecraft/onesix/OneSixInstance.cpp @@ -145,6 +145,12 @@ QString OneSixInstance::getNativePath() const return natives_dir.absolutePath(); } +QString OneSixInstance::getLocalLibraryPath() const +{ + QDir libraries_dir(FS::PathCombine(instanceRoot(), "libraries/")); + return libraries_dir.absolutePath(); +} + QString OneSixInstance::mainJarPath() const { auto jarMods = getJarMods(); @@ -207,7 +213,7 @@ QString OneSixInstance::createLaunchScript(AuthSessionPtr session) { QStringList jars, nativeJars; auto javaArchitecture = settings()->get("JavaArchitecture").toString(); - m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars); + m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars, getLocalLibraryPath()); for(auto file: jars) { launchScript += "cp " + file + "\n"; @@ -251,7 +257,7 @@ QStringList OneSixInstance::verboseDescription(AuthSessionPtr session) out << "Libraries:"; QStringList jars, nativeJars; auto javaArchitecture = settings()->get("JavaArchitecture").toString(); - m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars); + m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars, getLocalLibraryPath()); auto printLibFile = [&](const QString & path) { QFileInfo info(path); @@ -654,7 +660,7 @@ QStringList OneSixInstance::getClassPath() const { QStringList jars, nativeJars; auto javaArchitecture = settings()->get("JavaArchitecture").toString(); - m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars); + m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars, getLocalLibraryPath()); jars.append(mainJarPath()); return jars; } @@ -668,6 +674,6 @@ QStringList OneSixInstance::getNativeJars() const { QStringList jars, nativeJars; auto javaArchitecture = settings()->get("JavaArchitecture").toString(); - m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars); + m_profile->getLibraryFiles(javaArchitecture, jars, nativeJars, getLocalLibraryPath()); return nativeJars; } diff --git a/api/logic/minecraft/onesix/OneSixInstance.h b/api/logic/minecraft/onesix/OneSixInstance.h index c857075f..170921ae 100644 --- a/api/logic/minecraft/onesix/OneSixInstance.h +++ b/api/logic/minecraft/onesix/OneSixInstance.h @@ -104,6 +104,8 @@ public: QStringList getNativeJars() const override; QString getNativePath() const override; + QString getLocalLibraryPath() const override; + QStringList processMinecraftArgs(AuthSessionPtr account) const override; protected: diff --git a/api/logic/minecraft/onesix/update/LibrariesTask.cpp b/api/logic/minecraft/onesix/update/LibrariesTask.cpp index 123b14a3..1efbc64c 100644 --- a/api/logic/minecraft/onesix/update/LibrariesTask.cpp +++ b/api/logic/minecraft/onesix/update/LibrariesTask.cpp @@ -42,7 +42,7 @@ void LibrariesTask::executeTask() QStringList failedFiles; for (auto lib : libs) { - auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles); + auto dls = lib->getDownloads(currentSystem, metacache.get(), failedFiles, inst->getLocalLibraryPath()); for(auto dl : dls) { downloadJob->addNetAction(dl); diff --git a/api/logic/minecraft/testdata/codecwav-20101023.jar b/api/logic/minecraft/testdata/codecwav-20101023.jar new file mode 100644 index 00000000..f5236083 --- /dev/null +++ b/api/logic/minecraft/testdata/codecwav-20101023.jar @@ -0,0 +1 @@ +dummy test file. diff --git a/api/logic/minecraft/testdata/testname-testversion-linux-32.jar b/api/logic/minecraft/testdata/testname-testversion-linux-32.jar new file mode 100644 index 00000000..f5236083 --- /dev/null +++ b/api/logic/minecraft/testdata/testname-testversion-linux-32.jar @@ -0,0 +1 @@ +dummy test file. |