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

Function searchFolderByPath

src/XMLReader.cpp:10–28  ·  view source on GitHub ↗

this is obviously an incredibly inefficient way to go about searching but I don't think it'll matter too much with the size of most collections

Source from the content-addressed store, hash-verified

8//this is obviously an incredibly inefficient way to go about searching
9//but I don't think it'll matter too much with the size of most collections
10GameData* searchFolderByPath(FolderData* folder, std::string const& path)
11{
12 for(unsigned int i = 0; i < folder->getFileCount(); i++)
13 {
14 FileData* file = folder->getFile(i);
15
16 if(file->isFolder())
17 {
18 GameData* result = searchFolderByPath((FolderData*)file, path);
19 if(result)
20 return (GameData*)result;
21 }else{
22 if(file->getPath() == path)
23 return (GameData*)file;
24 }
25 }
26
27 return NULL;
28}
29
30GameData* createGameFromPath(std::string gameAbsPath, SystemData* system)
31{

Callers 1

parseGamelistFunction · 0.85

Calls 3

getFileCountMethod · 0.80
getFileMethod · 0.80
isFolderMethod · 0.45

Tested by

no test coverage detected