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

Method getFileData

src/resources/ResourceManager.cpp:12–37  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

10auto nop_deleter = [](unsigned char* p) { };
11
12const ResourceData ResourceManager::getFileData(const std::string& path) const
13{
14 //check if its embedded
15
16 if(res2hMap.find(path) != res2hMap.end())
17 {
18 //it is
19 Res2hEntry embeddedEntry = res2hMap.find(path)->second;
20 ResourceData data = {
21 std::shared_ptr<unsigned char>(const_cast<unsigned char*>(embeddedEntry.data), nop_deleter),
22 embeddedEntry.size
23 };
24 return data;
25 }
26
27 //it's not embedded; load the file
28 if(!fs::exists(path))
29 {
30 //if the file doesn't exist, return an "empty" ResourceData
31 ResourceData data = {NULL, 0};
32 return data;
33 }else{
34 ResourceData data = loadFile(path);
35 return data;
36 }
37}
38
39ResourceData ResourceManager::loadFile(const std::string& path) const
40{

Callers 2

reloadMethod · 0.80
reloadMethod · 0.80

Calls 2

findMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected