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
| 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 |
| 10 | GameData* 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 | |
| 30 | GameData* createGameFromPath(std::string gameAbsPath, SystemData* system) |
| 31 | { |
no test coverage detected