MCPcopy Create free account
hub / github.com/REGoth-project/REGoth / loadFileToMemory

Method loadFileToMemory

src/utils/Utils.cpp:190–204  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

188}
189
190const bgfx::Memory* Utils::loadFileToMemory(const char* _filePath)
191{
192 if (bx::open(fileReader, _filePath))
193 {
194 uint32_t size = (uint32_t)bx::getSize(fileReader);
195 const bgfx::Memory* mem = bgfx::alloc(size + 1);
196 bx::read(fileReader, mem->data, size);
197 bx::close(fileReader);
198 mem->data[mem->size - 1] = '\0';
199 return mem;
200 }
201
202 LogWarn() << "Failed to load file at: " << _filePath;
203 return NULL;
204}
205
206std::string Utils::stripExtension(const std::string& fileName)
207{

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected