MCPcopy Create free account
hub / github.com/FreesmTeam/FreesmLauncher / getApplicableFiles

Method getApplicableFiles

launcher/minecraft/Library.cpp:59–93  ·  view source on GitHub ↗

* @brief Collect applicable files for the library. * * Depending on whether the library is native or not, it adds paths to the * appropriate lists for jar files, native libraries for 32-bit, and native * libraries for 64-bit. * * @param runtimeContext The current runtime context. * @param jar List to store paths for jar files. * @param native List to store paths for native libraries. * @p

Source from the content-addressed store, hash-verified

57 * @param overridePath Optional path to override the default storage path.
58 */
59void Library::getApplicableFiles(const RuntimeContext& runtimeContext,
60 QStringList& jar,
61 QStringList& native,
62 QStringList& native32,
63 QStringList& native64,
64 const QString& overridePath) const
65{
66 bool local = isLocal();
67 // Lambda function to get the absolute file path
68 auto actualPath = [&](QString relPath) {
69 relPath = FS::RemoveInvalidPathChars(relPath);
70 QFileInfo out(FS::PathCombine(storagePrefix(), relPath));
71 if (local && !overridePath.isEmpty()) {
72 QString fileName = out.fileName();
73 return QFileInfo(FS::PathCombine(overridePath, fileName)).absoluteFilePath();
74 }
75 return out.absoluteFilePath();
76 };
77
78 QString raw_storage = storageSuffix(runtimeContext);
79 if (isNative()) {
80 if (raw_storage.contains("${arch}")) {
81 auto nat32Storage = raw_storage;
82 nat32Storage.replace("${arch}", "32");
83 auto nat64Storage = raw_storage;
84 nat64Storage.replace("${arch}", "64");
85 native32 += actualPath(nat32Storage);
86 native64 += actualPath(nat64Storage);
87 } else {
88 native += actualPath(raw_storage);
89 }
90 } else {
91 jar += actualPath(raw_storage);
92 }
93}
94
95/**
96 * @brief Get download requests for the library files.

Callers 14

extraArgumentsMethod · 0.80
getJarModsMethod · 0.80
getLibraryFilesMethod · 0.80
executeTaskMethod · 0.80
test_legacyMethod · 0.80
test_legacy_nativeMethod · 0.80
test_onenineMethod · 0.80

Calls 6

RemoveInvalidPathCharsFunction · 0.85
PathCombineFunction · 0.85
QFileInfoClass · 0.85
isEmptyMethod · 0.45
containsMethod · 0.45
replaceMethod · 0.45

Tested by 9

test_legacyMethod · 0.64
test_legacy_nativeMethod · 0.64
test_onenineMethod · 0.64
test_onenine_nativeMethod · 0.64