-------------------------------------- FileResourceManager::GetLoadData Retrieve the data for this asset
| 69 | // Retrieve the data for this asset |
| 70 | // |
| 71 | bool FileResourceManager::GetLoadData(core::I_Asset const* const asset, std::vector<uint8>& outData) const |
| 72 | { |
| 73 | // figure out which directory we need to search in |
| 74 | core::Directory const* const searchDir = (IsEngineResource(asset) ? m_EngineDir : m_ProjectDir); |
| 75 | |
| 76 | // find the database file |
| 77 | core::Entry* const dbEntry = searchDir->GetMountedChild(asset->GetPath() + asset->GetName()); |
| 78 | |
| 79 | // make sure we have a valid asset |
| 80 | if ((dbEntry == nullptr) || (dbEntry->GetType() == core::Entry::ENTRY_DIRECTORY)) |
| 81 | { |
| 82 | LOG(FS("Asset '%s' not found at location: %s", asset->GetName().c_str(), (searchDir->GetName() + asset->GetPath()).c_str()), core::LogLevel::Warning); |
| 83 | return false; |
| 84 | } |
| 85 | |
| 86 | // open the file |
| 87 | core::File* const dbFile = static_cast<core::File*>(dbEntry); |
| 88 | if (!(dbFile->Open(core::FILE_ACCESS_MODE::Read))) |
| 89 | { |
| 90 | LOG(FS("Failed to open file '%s'", dbFile->GetName()), core::LogLevel::Warning); |
| 91 | return false; |
| 92 | } |
| 93 | |
| 94 | // read the file into our load data array |
| 95 | outData = dbFile->Read(); |
| 96 | return true; |
| 97 | } |
| 98 | |
| 99 | //--------------------------------- |
| 100 | // FileResourceManager::Flush |