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/path-io | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'build/path-io') diff --git a/build/path-io b/build/path-io index a9deea9..accdb94 100644 --- a/build/path-io +++ b/build/path-io @@ -8,14 +8,26 @@ #include #include -#include namespace build { inline std::ostream& operator<< (std::ostream& os, const path& p) { - return os << (&os == diag_stream ? diag_relative (p) : p.string ()); + return os << p.string (); + } + + inline std::ostream& + operator<< (std::ostream& os, const dir_path& d) + { + const std::string& s (d.string ()); + + // Print the directory with trailing '/'. + // + if (!s.empty ()) + os << s << (dir_path::traits::is_separator (s.back ()) ? "" : "/"); + + return os; } } -- cgit v1.1