From 24599c552d561a53375e5f76bb695cbfbb5eb934 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Sun, 22 Jun 2014 13:11:27 +1000 Subject: [PATCH] Add function PBD::find_paths_matching_filter --- libs/pbd/file_utils.cc | 11 +++++++++++ libs/pbd/pbd/file_utils.h | 13 +++++++++++++ 2 files changed, 24 insertions(+) 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 @@ -289,6 +289,17 @@ find_files_matching_regex (vector& result, regfree (&compiled_pattern); } +void +find_paths_matching_filter (vector& 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& result, const Searchpath& paths, 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 @@ -109,6 +109,19 @@ find_files_matching_regex (std::vector& results, const Searchpath& dirpath, 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&, + 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) */