From db0edaafe15831ba6fa9c2109da37942506c62b1 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Sat, 23 Jan 2016 11:14:05 +0200 Subject: Cleanup absolute/relative path diagnostics by introducing stream verbosity --- build2/prerequisite.cxx | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'build2/prerequisite.cxx') diff --git a/build2/prerequisite.cxx b/build2/prerequisite.cxx index 2192abe..fb432eb 100644 --- a/build2/prerequisite.cxx +++ b/build2/prerequisite.cxx @@ -22,16 +22,26 @@ namespace build2 { if (pk.proj != nullptr) os << *pk.proj << '%'; - - // Don't print scope if we are project-qualified or the - // prerequisite's directory is absolute. In both these - // cases the scope is not used to resolve it to target. + // + // Don't print scope if we are project-qualified or the prerequisite's + // directory is absolute. In both these cases the scope is not used to + // resolve it to target. // else if (!pk.tk.dir->absolute ()) { - string s (diag_relative (pk.scope->out_path (), false)); + // Avoid printing './' in './:...', similar to what we do for the + // directory in target_key. + // + const dir_path& s (pk.scope->out_path ()); + + if (stream_verb (os) < 2) + { + const string& r (diag_relative (s, false)); - if (!s.empty ()) + if (!r.empty ()) + os << r << ':'; + } + else os << s << ':'; } -- cgit v1.1