summaryrefslogtreecommitdiff
path: root/libs
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2014-06-22 13:11:27 +1000
committerPaul Davis <paul@linuxaudiosystems.com>2014-06-25 12:40:10 -0400
commit24599c552d561a53375e5f76bb695cbfbb5eb934 (patch)
tree7874ae4d7a26f67a3cf4bc411f7fef261700105b /libs
parent54c0a0144c726e51a3a43ccd91c86328b18c5087 (diff)
Add function PBD::find_paths_matching_filter
Diffstat (limited to 'libs')
-rw-r--r--libs/pbd/file_utils.cc11
-rw-r--r--libs/pbd/pbd/file_utils.h13
2 files changed, 24 insertions, 0 deletions
diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc
index 9d7075e942..eb9661eab6 100644
--- a/libs/pbd/file_utils.cc
+++ b/libs/pbd/file_utils.cc
@@ -290,6 +290,17 @@ find_files_matching_regex (vector<string>& result,
}
void
+find_paths_matching_filter (vector<string>& result,
+ const Searchpath& paths,
+ bool (*filter)(const string &, void *),
+ void *arg,
+ bool match_fullpath, bool return_fullpath,
+ bool recurse)
+{
+ run_functor_for_paths (result, paths, filter, arg, false, match_fullpath, return_fullpath, recurse);
+}
+
+void
find_files_matching_filter (vector<string>& result,
const Searchpath& paths,
bool (*filter)(const string &, void *),
diff --git a/libs/pbd/pbd/file_utils.h b/libs/pbd/pbd/file_utils.h
index bd9eccf240..ab42fd2357 100644
--- a/libs/pbd/pbd/file_utils.h
+++ b/libs/pbd/pbd/file_utils.h
@@ -110,6 +110,19 @@ find_files_matching_regex (std::vector<std::string>& results,
const std::string& regexp);
/**
+ * @return paths in a Searchpath that match a supplied filter(functor)
+ * @note results include files and directories
+ */
+LIBPBD_API void
+find_paths_matching_filter (std::vector<std::string>&,
+ const Searchpath& paths,
+ bool (*filter)(const std::string &, void *),
+ void *arg,
+ bool match_fullpath,
+ bool return_fullpath,
+ bool recurse = false);
+
+/**
* @return files in a Searchpath that match a supplied filter(functor)
*/
LIBPBD_API void