------------------------------------------------------------------------
| 303 | |
| 304 | //------------------------------------------------------------------------ |
| 305 | Module::SnapshotList Module::getSnapshots (const std::string& modulePath) |
| 306 | { |
| 307 | SnapshotList result; |
| 308 | filesystem::path path (modulePath); |
| 309 | path /= "Contents"; |
| 310 | path /= "Resources"; |
| 311 | path /= "Snapshots"; |
| 312 | PathList pngList; |
| 313 | findFilesWithExt (path, ".png", pngList, false); |
| 314 | for (auto& png : pngList) |
| 315 | { |
| 316 | filesystem::path p (png); |
| 317 | auto filename = p.filename ().generic_string (); |
| 318 | auto uid = Snapshot::decodeUID (filename); |
| 319 | if (!uid) |
| 320 | continue; |
| 321 | auto scaleFactor = 1.; |
| 322 | if (auto decodedScaleFactor = Snapshot::decodeScaleFactor (filename)) |
| 323 | scaleFactor = *decodedScaleFactor; |
| 324 | |
| 325 | Module::Snapshot::ImageDesc desc; |
| 326 | desc.scaleFactor = scaleFactor; |
| 327 | desc.path = std::move (png); |
| 328 | bool found = false; |
| 329 | for (auto& entry : result) |
| 330 | { |
| 331 | if (entry.uid != *uid) |
| 332 | continue; |
| 333 | found = true; |
| 334 | entry.images.emplace_back (std::move (desc)); |
| 335 | break; |
| 336 | } |
| 337 | if (found) |
| 338 | continue; |
| 339 | Module::Snapshot snapshot; |
| 340 | snapshot.uid = *uid; |
| 341 | snapshot.images.emplace_back (std::move (desc)); |
| 342 | result.emplace_back (std::move (snapshot)); |
| 343 | } |
| 344 | return result; |
| 345 | } |
| 346 | |
| 347 | //------------------------------------------------------------------------ |
| 348 | } // Hosting |
nothing calls this directly
no test coverage detected