From ace1743f7f78bb13f99553d6e97ad1beecf1ba99 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Mon, 13 Apr 2015 15:50:17 +0200 Subject: Add separate type to represent directory paths --- build/diagnostics.cxx | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) (limited to 'build/diagnostics.cxx') diff --git a/build/diagnostics.cxx b/build/diagnostics.cxx index 2fad0d3..bc157ed 100644 --- a/build/diagnostics.cxx +++ b/build/diagnostics.cxx @@ -57,6 +57,24 @@ namespace build return p.string (); } + string + diag_relative (const dir_path& d, bool cur) + { + string r (diag_relative (static_cast (d))); + + // Translate "." to empty. + // + if (!cur && d.absolute () && r == ".") + r.clear (); + + // Add trailing '/'. + // + if (!r.empty () && !dir_path::traits::is_separator (r.back ())) + r += '/'; + + return r; + } + // diag_do(), etc. // string -- cgit v1.1