| 360 | } |
| 361 | |
| 362 | LibraryPtr OneSixVersionFormat::plusJarModFromJson([[maybe_unused]] ProblemContainer& problems, |
| 363 | const QJsonObject& libObj, |
| 364 | const QString& filename, |
| 365 | const QString& originalName) |
| 366 | { |
| 367 | LibraryPtr out(new Library()); |
| 368 | if (!libObj.contains("name")) { |
| 369 | throw JSONValidationError(filename + "contains a jarmod that doesn't have a 'name' field"); |
| 370 | } |
| 371 | |
| 372 | // just make up something unique on the spot for the library name. |
| 373 | auto uuid = QUuid::createUuid(); |
| 374 | QString id = uuid.toString().remove('{').remove('}'); |
| 375 | out->setRawName(GradleSpecifier("org.multimc.jarmods:" + id + ":1")); |
| 376 | |
| 377 | // filename override is the old name |
| 378 | out->setFilename(libObj.value("name").toString()); |
| 379 | |
| 380 | // it needs to be local, it is stored in the instance jarmods folder |
| 381 | out->setHint("local"); |
| 382 | |
| 383 | // read the original name if present - some versions did not set it |
| 384 | // it is the original jar mod filename before it got renamed at the point of addition |
| 385 | auto displayName = libObj.value("originalName").toString(); |
| 386 | if (displayName.isEmpty()) { |
| 387 | auto fixed = originalName; |
| 388 | fixed.remove(" (jar mod)"); |
| 389 | out->setDisplayName(fixed); |
| 390 | } else { |
| 391 | out->setDisplayName(displayName); |
| 392 | } |
| 393 | return out; |
| 394 | } |
| 395 | |
| 396 | LibraryPtr OneSixVersionFormat::jarModFromJson(ProblemContainer& problems, const QJsonObject& libObj, const QString& filename) |
| 397 | { |
nothing calls this directly
no test coverage detected