summaryrefslogtreecommitdiff
path: root/src/filesys.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/filesys.cpp')
-rw-r--r--src/filesys.cpp31
1 files changed, 26 insertions, 5 deletions
diff --git a/src/filesys.cpp b/src/filesys.cpp
index d965384a2..694169d20 100644
--- a/src/filesys.cpp
+++ b/src/filesys.cpp
@@ -380,15 +380,36 @@ std::string TempPath()
#endif
-void GetRecursiveSubPaths(const std::string &path, std::vector<std::string> &dst)
+void GetRecursiveDirs(std::vector<std::string> &dirs, const std::string &dir)
+{
+ static const std::set<char> chars_to_ignore = { '_', '.' };
+ if (dir.empty() || !IsDir(dir))
+ return;
+ dirs.push_back(dir);
+ fs::GetRecursiveSubPaths(dir, dirs, false, chars_to_ignore);
+}
+
+std::vector<std::string> GetRecursiveDirs(const std::string &dir)
+{
+ std::vector<std::string> result;
+ GetRecursiveDirs(result, dir);
+ return result;
+}
+
+void GetRecursiveSubPaths(const std::string &path,
+ std::vector<std::string> &dst,
+ bool list_files,
+ const std::set<char> &ignore)
{
std::vector<DirListNode> content = GetDirListing(path);
for (const auto &n : content) {
std::string fullpath = path + DIR_DELIM + n.name;
- dst.push_back(fullpath);
- if (n.dir) {
- GetRecursiveSubPaths(fullpath, dst);
- }
+ if (ignore.count(n.name[0]))
+ continue;
+ if (list_files || n.dir)
+ dst.push_back(fullpath);
+ if (n.dir)
+ GetRecursiveSubPaths(fullpath, dst, list_files, ignore);
}
}