aboutsummaryrefslogtreecommitdiff
path: root/build/path-io
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-04-13 15:50:17 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-04-13 15:50:17 +0200
commitace1743f7f78bb13f99553d6e97ad1beecf1ba99 (patch)
tree595bc9dad989e44f4be9a67e351219f3248dc5f0 /build/path-io
parent534f9d8db025d58c9ce23f3b81a37e8c34386a27 (diff)
Add separate type to represent directory paths
Diffstat (limited to 'build/path-io')
-rw-r--r--build/path-io16
1 files changed, 14 insertions, 2 deletions
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 <ostream>
#include <build/path>
-#include <build/diagnostics>
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;
}
}