Skip to content

Commit 2a76061

Browse files
committed
Add getAllFilesFromSearchPaths method to paths-posix.cpp
1 parent 03f8ed8 commit 2a76061

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

TheForceEngine/TFE_FileSystem/paths-posix.cpp

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -351,4 +351,25 @@ namespace TFE_Paths
351351
{
352352
return FileUtil::exists("settings.ini");
353353
}
354+
355+
void getAllFilesFromSearchPaths(const char* subdirectory, const char* ext, FileList& allJsonFiles)
356+
{
357+
size_t pathCount = s_searchPaths.size();
358+
for (size_t p = 0; p < pathCount; p++)
359+
{
360+
std::vector<string> fileList;
361+
char dir[TFE_MAX_PATH];
362+
sprintf(dir, "%s%s%s", s_searchPaths[p].c_str(), subdirectory, "/");
363+
FileUtil::readDirectory(dir, ext, fileList);
364+
365+
// Add each file in the fileList to the result
366+
for (int f = 0; f < fileList.size(); f++)
367+
{
368+
char filePath[TFE_MAX_PATH];
369+
string file = fileList[f];
370+
sprintf(filePath, "%s%s", dir, file.c_str());
371+
allJsonFiles.push_back(filePath);
372+
}
373+
}
374+
}
354375
}

0 commit comments

Comments
 (0)