| 297 | } |
| 298 | |
| 299 | std::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 | |
| 325 | static std::list<UString> recursiveFindFilesInDirectory(const FileSystem &fs, UString path, |
| 326 | const UString &extension) |
no test coverage detected