diff options
author | Karen Arutyunov <karen@codesynthesis.com> | 2017-03-10 20:20:12 +0300 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2017-03-13 13:18:21 +0200 |
commit | 482d362979baf8b0fef7f46b0cd61a29faeb11a8 (patch) | |
tree | 0264746045798679cfee2e748d00bdd7ca050cb0 | |
parent | 6dbf4954a67efa284ae9abceb3b02c8642b79a49 (diff) |
Adapt for path_search() change
-rw-r--r-- | build2/parser.cxx | 12 | ||||
-rw-r--r-- | build2/test/script/runner.cxx | 32 |
2 files changed, 26 insertions, 18 deletions
diff --git a/build2/parser.cxx b/build2/parser.cxx index 7a84bae..50fcc06 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -2425,17 +2425,19 @@ namespace build2 //@@ PAT TODO: weed out starting with dot (unless pattern starts // with dot; last component? intermediate components?). // - function<bool (path&&)> func; + function<bool (path&&, const string&, bool)> func; if (unique) - func = [a, &append] (path&& m) + func = [a, &append] (path&& m, const string&, bool interm) { - append (move (m).representation (), a); + if (!interm) + append (move (m).representation (), a); return true; }; else - func = [a, &include_match] (path&& m) + func = [a, &include_match] (path&& m, const string&, bool interm) { - include_match (move (m).representation (), a); + if (!interm) + include_match (move (m).representation (), a); return true; }; diff --git a/build2/test/script/runner.cxx b/build2/test/script/runner.cxx index e8040e2..68a8d32 100644 --- a/build2/test/script/runner.cxx +++ b/build2/test/script/runner.cxx @@ -718,30 +718,36 @@ namespace build2 if (l.to_directory ()) { - auto rm = [&p, &d, &ll] (path&& de) -> bool + auto rm = + [&p, &d, &ll] (path&& de, const string&, bool interm) -> bool { - dir_path sd (path_cast<dir_path> (d / de)); + if (!interm) + { + dir_path sd (path_cast<dir_path> (d / de)); - // We can get not_exist here due to racing conditions, but - // that's ok if somebody did our job. - // - rmdir_status r (rmdir (sd, 2)); + // We can get not_exist here due to racing conditions, but + // that's ok if somebody did our job. + // + rmdir_status r (rmdir (sd, 2)); - if (r != rmdir_status::not_empty) - return true; + if (r == rmdir_status::not_empty) + fail (ll) << "registered for cleanup directory " << sd + << " is not empty" << + info << "wildcard: '" << p << "'"; + } - fail (ll) << "registered for cleanup directory " << sd - << " is not empty" << - info << "wildcard: '" << p << "'" << endf; + return true; }; path_search (l, rm, d); } else { - auto rm = [&d] (path&& p) -> bool + auto rm = [&d] (path&& p, const string&, bool interm) -> bool { - rmfile (d / p, 2); // That's ok if not exists. + if (!interm) + rmfile (d / p, 2); // That's ok if not exists. + return true; }; |