| 470 | } |
| 471 | |
| 472 | QString buildPathToIntegratedAppImage(const QString& pathToAppImage) { |
| 473 | // if type 2 AppImage, we can build a "content-aware" filename |
| 474 | // see #7 for details |
| 475 | auto digest = getAppImageDigestMd5(pathToAppImage); |
| 476 | |
| 477 | const QFileInfo appImageInfo(pathToAppImage); |
| 478 | |
| 479 | QString baseName = appImageInfo.completeBaseName(); |
| 480 | |
| 481 | // if digest is available, append a separator |
| 482 | if (!digest.isEmpty()) { |
| 483 | const auto digestSuffix = "_" + digest; |
| 484 | |
| 485 | // check whether digest is already contained in filename |
| 486 | if (!pathToAppImage.contains(digestSuffix)) |
| 487 | baseName += "_" + digest; |
| 488 | } |
| 489 | |
| 490 | auto fileName = baseName; |
| 491 | |
| 492 | // must not use completeSuffix() in combination with completeBasename(), otherwise the final filename is composed |
| 493 | // incorrectly |
| 494 | if (!appImageInfo.suffix().isEmpty()) { |
| 495 | fileName += "." + appImageInfo.suffix(); |
| 496 | } |
| 497 | |
| 498 | return integratedAppImagesDestination().path() + "/" + fileName; |
| 499 | } |
| 500 | |
| 501 | std::map<std::string, std::string> findCollisions(const QString& currentNameEntry) { |
| 502 | std::map<std::string, std::string> collisions{}; |
no test coverage detected