aboutsummaryrefslogtreecommitdiff
path: root/butl/filesystem
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2017-03-10 00:14:00 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2017-03-13 14:45:32 +0300
commitdc2c25e3f3182e8181a15487de4befca74a1ffec (patch)
treeb83cfb83188abd2c361f9eb839cc3600fb1f8f44 /butl/filesystem
parent870da718e38555352343a46ce02fb46d5eb3a365 (diff)
Add flexibility to path search callback function
Diffstat (limited to 'butl/filesystem')
-rw-r--r--butl/filesystem29
1 files changed, 19 insertions, 10 deletions
diff --git a/butl/filesystem b/butl/filesystem
index 5a8eb91..336233c 100644
--- a/butl/filesystem
+++ b/butl/filesystem
@@ -460,21 +460,30 @@ namespace butl
// As an example, consider pattern f*/bar/b*/*.txt and path
// foo/bar/baz/x.txt. The sequence of calls in this case will be:
//
- // (foo/, f*/, true)
- // (foo/bar/baz/, b*/, true)
+ // (foo/, f*/, true)
+ // (foo/bar/baz/, b*/, true)
// (foo/bar/baz/x.txt, *.txt, false)
//
+ // If the pattern contains a recursive wildcard, then the callback function
+ // can be called for the same directory twice: first time as an intermediate
+ // match with */ pattern to decide if to recursively traverse the directory,
+ // and the second time if the directory matches the pattern component (either
+ // as an intermediate or a final match). As an example, consider pattern
+ // b**/c* and directory tree a/b/c/. The sequence of calls in this case will
+ // be:
+ //
+ // (a/, */, true)
+ // (a/b/, */ true)
+ // (a/b/c/, */, true)
+ // (a/b/, b*/, true)
+ // (a/b/c/, c*/, false)
+ //
LIBBUTL_EXPORT void
path_search (const path& pattern,
- const std::function<bool (path&&)>&,
+ const std::function<bool (path&&,
+ const std::string& pattern,
+ bool interm)>&,
const dir_path& start = dir_path ());
- /*
- LIBBUTL_EXPORT void
- path_search (
- const path& pattern,
- const std::function<bool (path&&, const string& pattern, bool interm)>&,
- const dir_path& start = dir_path ());
- */
}
#include <butl/filesystem.ixx>