-------------------------------------- PackageResourceManager::GetLoadData Retrieve the data for this asset from its package
| 83 | // Retrieve the data for this asset from its package |
| 84 | // |
| 85 | bool PackageResourceManager::GetLoadData(core::I_Asset const* const asset, std::vector<uint8>& outData) const |
| 86 | { |
| 87 | // Get the package the asset lives in |
| 88 | auto const foundPackageIt = std::find_if(m_Packages.begin(), m_Packages.end(), [asset](T_IndexedPackage const& indexedPackage) |
| 89 | { |
| 90 | return indexedPackage.first == asset->GetPackageId(); |
| 91 | }); |
| 92 | |
| 93 | // check the iterator is valid |
| 94 | if (foundPackageIt == m_Packages.cend()) |
| 95 | { |
| 96 | LOG(FS("No package (id:'%s') found for asset '%s'", asset->GetPackageId().ToStringDbg(), asset->GetName().c_str()), core::LogLevel::Warning); |
| 97 | return false; |
| 98 | } |
| 99 | |
| 100 | // get binary data from the package |
| 101 | if (!(foundPackageIt->second->GetEntryData(asset->GetPackageEntryId(), outData))) |
| 102 | { |
| 103 | return false; |
| 104 | } |
| 105 | |
| 106 | return true; |
| 107 | } |
| 108 | |
| 109 | //--------------------------------- |
| 110 | // PackageResourceManager::Flush |
nothing calls this directly
no test coverage detected