From c699c956d75dfaaded5bb24c5ea16edc73588649 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 27 Mar 2015 16:14:10 +0200 Subject: Rework dependency state dump support We now have a combined (scopes, variables, and targets) dump. --- build/diagnostics.cxx | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) (limited to 'build/diagnostics.cxx') diff --git a/build/diagnostics.cxx b/build/diagnostics.cxx index f5802de..53d1a09 100644 --- a/build/diagnostics.cxx +++ b/build/diagnostics.cxx @@ -14,11 +14,13 @@ using namespace std; namespace build { string - diag_relative_work (const path& p) + diag_relative (const path& p) { + const path& b (*relative_base); + if (p.absolute ()) { - if (p == work) + if (p == b) return "."; #ifndef _WIN32 @@ -26,26 +28,26 @@ namespace build return "~"; #endif - path rw (relative_work (p)); + path rb (relative (p)); #ifndef _WIN32 - if (rw.relative ()) + if (rb.relative ()) { // See if the original path with the ~/ shortcut is better - // that the relative to work. + // that the relative to base. // if (p.sub (home)) { path rh (p.leaf (home)); - if (rw.string ().size () > rh.string ().size () + 2) // 2 for '~/' + if (rb.string ().size () > rh.string ().size () + 2) // 2 for '~/' return "~/" + rh.string (); } } - else if (rw.sub (home)) - return "~/" + rw.leaf (home).string (); + else if (rb.sub (home)) + return "~/" + rb.leaf (home).string (); #endif - return rw.string (); + return rb.string (); } return p.string (); -- cgit v1.1