* @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
| 57 | * @param overridePath Optional path to override the default storage path. |
| 58 | */ |
| 59 | void 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. |