| 389 | } |
| 390 | |
| 391 | LibraryPtr OneSixVersionFormat::plusJarModFromJson( |
| 392 | ProblemContainer & problems, |
| 393 | const QJsonObject &libObj, |
| 394 | const QString &filename, |
| 395 | const QString &originalName |
| 396 | ) { |
| 397 | LibraryPtr out(new Library()); |
| 398 | if (!libObj.contains("name")) |
| 399 | { |
| 400 | throw JSONValidationError(filename + |
| 401 | "contains a jarmod that doesn't have a 'name' field"); |
| 402 | } |
| 403 | |
| 404 | // just make up something unique on the spot for the library name. |
| 405 | auto uuid = QUuid::createUuid(); |
| 406 | QString id = uuid.toString().remove('{').remove('}'); |
| 407 | out->setRawName(GradleSpecifier("org.multimc.jarmods:" + id + ":1")); |
| 408 | |
| 409 | // filename override is the old name |
| 410 | out->setFilename(libObj.value("name").toString()); |
| 411 | |
| 412 | // it needs to be local, it is stored in the instance jarmods folder |
| 413 | out->setHint("local"); |
| 414 | |
| 415 | // read the original name if present - some versions did not set it |
| 416 | // it is the original jar mod filename before it got renamed at the point of addition |
| 417 | auto displayName = libObj.value("originalName").toString(); |
| 418 | if(displayName.isEmpty()) |
| 419 | { |
| 420 | auto fixed = originalName; |
| 421 | fixed.remove(" (jar mod)"); |
| 422 | out->setDisplayName(fixed); |
| 423 | } |
| 424 | else |
| 425 | { |
| 426 | out->setDisplayName(displayName); |
| 427 | } |
| 428 | return out; |
| 429 | } |
| 430 | |
| 431 | LibraryPtr OneSixVersionFormat::jarModFromJson(ProblemContainer & problems, const QJsonObject& libObj, const QString& filename) |
| 432 | { |
nothing calls this directly
no test coverage detected