------------------------------------------------------------------------
| 457 | |
| 458 | //------------------------------------------------------------------------ |
| 459 | Module::SnapshotList Module::getSnapshots (const std::string& modulePath) |
| 460 | { |
| 461 | SnapshotList result; |
| 462 | auto path = getContentsDirectoryFromModuleExecutablePath (modulePath); |
| 463 | if (!path) |
| 464 | return result; |
| 465 | |
| 466 | *path /= "Resources"; |
| 467 | *path /= "Snapshots"; |
| 468 | |
| 469 | if (filesystem::exists (*path) == false) |
| 470 | return result; |
| 471 | |
| 472 | PathList pngList; |
| 473 | findFilesWithExt (*path, ".png", pngList, false); |
| 474 | for (auto& png : pngList) |
| 475 | { |
| 476 | filesystem::path p (png); |
| 477 | auto filename = p.filename ().generic_string (); |
| 478 | auto uid = Snapshot::decodeUID (filename); |
| 479 | if (!uid) |
| 480 | continue; |
| 481 | auto scaleFactor = 1.; |
| 482 | if (auto decodedScaleFactor = Snapshot::decodeScaleFactor (filename)) |
| 483 | scaleFactor = *decodedScaleFactor; |
| 484 | |
| 485 | Module::Snapshot::ImageDesc desc; |
| 486 | desc.scaleFactor = scaleFactor; |
| 487 | desc.path = std::move (png); |
| 488 | bool found = false; |
| 489 | for (auto& entry : result) |
| 490 | { |
| 491 | if (entry.uid != *uid) |
| 492 | continue; |
| 493 | found = true; |
| 494 | entry.images.emplace_back (std::move (desc)); |
| 495 | break; |
| 496 | } |
| 497 | if (found) |
| 498 | continue; |
| 499 | Module::Snapshot snapshot; |
| 500 | snapshot.uid = *uid; |
| 501 | snapshot.images.emplace_back (std::move (desc)); |
| 502 | result.emplace_back (std::move (snapshot)); |
| 503 | } |
| 504 | return result; |
| 505 | } |
| 506 | |
| 507 | //------------------------------------------------------------------------ |
| 508 | } // Hosting |
nothing calls this directly
no test coverage detected