From 9fb791e9fad6c63fc1dac49f4d05ae63b8a3db9b Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 5 Jan 2016 11:55:15 +0200 Subject: Rename build directory/namespace to build2 --- build2/path-io.cxx | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 build2/path-io.cxx (limited to 'build2/path-io.cxx') diff --git a/build2/path-io.cxx b/build2/path-io.cxx new file mode 100644 index 0000000..0ee50b4 --- /dev/null +++ b/build2/path-io.cxx @@ -0,0 +1,39 @@ +// file : build2/path-io.cxx -*- C++ -*- +// copyright : Copyright (c) 2014-2015 Code Synthesis Ltd +// license : MIT; see accompanying LICENSE file + +#include + +#include + +#include +#include + +using namespace std; + +namespace build2 +{ + ostream& + operator<< (ostream& os, const path& p) + { + return os << (relative (os) ? diag_relative (p) : p.string ()); + } + + ostream& + operator<< (ostream& os, const dir_path& d) + { + if (relative (os)) + os << diag_relative (d); + else + { + const 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