--------------------------------- FileResourceManager::InitDb Initialize an individual Asset Database
| 130 | // Initialize an individual Asset Database |
| 131 | // |
| 132 | void 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 |