MCPcopy Create free account
hub / github.com/Aloshi/EmulationStation / loadFile

Method loadFile

src/resources/ResourceManager.cpp:39–54  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

37}
38
39ResourceData ResourceManager::loadFile(const std::string& path) const
40{
41 std::ifstream stream(path, std::ios::binary);
42
43 stream.seekg(0, stream.end);
44 size_t size = (size_t)stream.tellg();
45 stream.seekg(0, stream.beg);
46
47 //supply custom deleter to properly free array
48 std::shared_ptr<unsigned char> data(new unsigned char[size], array_deleter);
49 stream.read((char*)data.get(), size);
50 stream.close();
51
52 ResourceData ret = {data, size};
53 return ret;
54}
55
56bool ResourceManager::fileExists(const std::string& path) const
57{

Callers 2

setDefaultsMethod · 0.45
readXMLMethod · 0.45

Calls 2

closeMethod · 0.80
getMethod · 0.45

Tested by

no test coverage detected