From 482d362979baf8b0fef7f46b0cd61a29faeb11a8 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Fri, 10 Mar 2017 20:20:12 +0300 Subject: Adapt for path_search() change --- build2/parser.cxx | 12 +++++++----- 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 func; + function 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 (d / de)); + if (!interm) + { + dir_path sd (path_cast (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; }; -- cgit v1.1