MCPcopy Create free account
hub / github.com/OpenApoc/OpenApoc / enumerateDirectory

Method enumerateDirectory

framework/physfs_fs.cpp:299–323  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

297}
298
299std::list<UString> FileSystem::enumerateDirectory(const UString &basePath,
300 const UString &extension) const
301{
302 std::list<UString> result;
303 bool filterByExtension = !extension.empty();
304
305 char **elements = PHYSFS_enumerateFiles(basePath.c_str());
306 for (char **element = elements; *element != NULL; element++)
307 {
308 if (!filterByExtension)
309 {
310 result.push_back(*element);
311 }
312 else
313 {
314 const UString elementString = (*element);
315 if (ends_with(elementString, extension))
316 {
317 result.push_back(elementString);
318 }
319 }
320 }
321 PHYSFS_freeList(elements);
322 return result;
323}
324
325static std::list<UString> recursiveFindFilesInDirectory(const FileSystem &fs, UString path,
326 const UString &extension)

Callers 3

extractMapSectorsMethod · 0.80

Calls 2

ends_withFunction · 0.85
emptyMethod · 0.80

Tested by

no test coverage detected