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

Method InitDb

Engine/source/EtEditor/Content/FileResourceManager.cpp:132–151  ·  view source on GitHub ↗

--------------------------------- FileResourceManager::InitDb Initialize an individual Asset Database

Source from the content-addressed store, hash-verified

130// Initialize an individual Asset Database
131//
132void FileResourceManager::InitDb(core::AssetDatabase& db, core::Directory*& dir, std::string const& path)
133{
134 // mount the directory
135 dir = new core::Directory(path + s_ResourceDirRelPath, nullptr, true);
136 dir->Mount(true);
137
138 // find the database file
139 core::Entry* const dbEntry = dir->GetMountedChild(s_DatabasePath);
140 ET_ASSERT(dbEntry != nullptr);
141 ET_ASSERT(dbEntry->GetType() == core::Entry::ENTRY_FILE);
142
143 core::File* const dbFile = static_cast<core::File*>(dbEntry);
144 dbFile->Open(core::FILE_ACCESS_MODE::Read);
145
146 // deserialize the database from that files content
147 if (!(core::serialization::DeserializeFromJsonString(core::FileUtil::AsText(dbFile->Read()), db)))
148 {
149 LOG(FS("FileResourceManager::Init > unable to deserialize asset DB at '%s'", dbEntry->GetName().c_str()), core::LogLevel::Error);
150 }
151}
152
153//---------------------------------
154// FileResourceManager::IsEngineResource

Callers

nothing calls this directly

Calls 6

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

Tested by

no test coverage detected