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

Method getFilesRecursive

src/FolderData.cpp:162–186  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

160}
161
162std::vector<FileData*> FolderData::getFilesRecursive(bool onlyFiles) const
163{
164 std::vector<FileData*> temp;
165 //now check if a child is a folder and get those children in turn
166 std::vector<FileData*>::const_iterator fdit = mFileVector.cbegin();
167 while(fdit != mFileVector.cend()) {
168 //dynamically try to cast to FolderData type
169 FolderData * folder = dynamic_cast<FolderData*>(*fdit);
170 if (folder != nullptr) {
171 //add this onyl when user wanted it
172 if (!onlyFiles) {
173 temp.push_back(*fdit);
174 }
175 //worked. Is actual folder data. recurse
176 std::vector<FileData*> children = folder->getFilesRecursive(onlyFiles);
177 //insert children into return vector
178 temp.insert(temp.end(), children.cbegin(), children.cend());
179 }
180 else {
181 temp.push_back(*fdit);
182 }
183 ++fdit;
184 }
185 return temp;
186}

Callers 1

updateGamelistFunction · 0.80

Calls 2

push_backMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected