MCPcopy Create free account
hub / github.com/Illation/ETEngine / GetLoadData

Method GetLoadData

Engine/source/EtEditor/Content/FileResourceManager.cpp:71–97  ·  view source on GitHub ↗

-------------------------------------- FileResourceManager::GetLoadData Retrieve the data for this asset

Source from the content-addressed store, hash-verified

69// Retrieve the data for this asset
70//
71bool 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

Callers 1

LoadMethod · 0.45

Calls 6

GetMountedChildMethod · 0.80
GetPathMethod · 0.80
GetNameMethod · 0.80
GetTypeMethod · 0.45
OpenMethod · 0.45
ReadMethod · 0.45

Tested by

no test coverage detected