summaryrefslogtreecommitdiff
path: root/src/utils/files.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/utils/files.cpp')
-rw-r--r--src/utils/files.cpp18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/utils/files.cpp b/src/utils/files.cpp
index e694a2b9e..0a3f3eb92 100644
--- a/src/utils/files.cpp
+++ b/src/utils/files.cpp
@@ -31,7 +31,9 @@
#include "utils/mkdir.h"
#include "utils/paths.h"
#include "utils/physfstools.h"
+#include "utils/stringutils.h"
+#include <algorithm>
#include <dirent.h>
#include <fstream>
#include <sstream>
@@ -363,3 +365,19 @@ void Files::deleteFilesInDirectory(std::string path)
if (dir)
closedir(dir);
}
+
+void Files::getFilesInDir(const std::string &dir,
+ StringVect &list,
+ const std::string &ext)
+{
+ const std::string path = dir + "/";
+ StringVect tempList;
+ Files::getFilesWithDir(path, tempList);
+ FOR_EACH (StringVectCIter, it, tempList)
+ {
+ const std::string &str = *it;
+ if (findLast(str, ext))
+ list.push_back(str);
+ }
+ std::sort(list.begin(), list.end());
+}