From 36fd67ab72866c9c049d8210d2d345d2adc4e7a6 Mon Sep 17 00:00:00 2001 From: Tim Mayberry Date: Thu, 19 Jun 2014 20:09:10 +1000 Subject: Add a variation of PBD::find_files_matching_pattern for convenience --- libs/pbd/file_utils.cc | 9 +++++++++ libs/pbd/pbd/file_utils.h | 18 ++++++++++++++++++ 2 files changed, 27 insertions(+) (limited to 'libs/pbd') diff --git a/libs/pbd/file_utils.cc b/libs/pbd/file_utils.cc index 511e046de3..98c8a6fcfc 100644 --- a/libs/pbd/file_utils.cc +++ b/libs/pbd/file_utils.cc @@ -137,6 +137,15 @@ find_files_matching_pattern (vector& result, } +void +find_files_matching_pattern (vector& result, + const Searchpath& paths, + const string& pattern) +{ + Glib::PatternSpec tmp(pattern); + find_files_matching_pattern (result, paths, tmp); +} + void find_matching_files_in_directory (const std::string& directory, const Glib::PatternSpec& pattern, diff --git a/libs/pbd/pbd/file_utils.h b/libs/pbd/pbd/file_utils.h index 3ced02f2aa..588e48217a 100644 --- a/libs/pbd/pbd/file_utils.h +++ b/libs/pbd/pbd/file_utils.h @@ -71,6 +71,24 @@ find_files_matching_pattern (std::vector& result, const Searchpath& paths, const Glib::PatternSpec& pattern); +/** + * Takes a Searchpath and returns all the files contained in the + * directory paths that match a particular pattern. + * + * This is a convenience method to avoid explicitly declaring + * temporary variables such as: + * find_files_matching_pattern (result, paths, string("*.ext")) + * + * @param result A vector in which to place the resulting matches. + * @param paths A Searchpath + * @param pattern A string representing the Glib::PatternSpec used + * to match the files. + */ +LIBPBD_API void +find_files_matching_pattern (std::vector& result, + const Searchpath& paths, + const std::string& pattern); + /** * Takes a directory path and returns all the files in the directory * matching a particular pattern. -- cgit v1.2.3