aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-09-04 14:13:25 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-09-04 14:13:25 +0200
commit06dc23bd590d003eca6109890974ca96ed6fd1a4 (patch)
treede30f230d9d34b0451c0e8807cdb148021e76f04
parent94c3574492b6db6ae8d5fbef717f8e6f92f1d402 (diff)
Print dir_path with trailing slash
-rw-r--r--bpkg/types17
1 files changed, 16 insertions, 1 deletions
diff --git a/bpkg/types b/bpkg/types
index 0394d56..2ab7aea 100644
--- a/bpkg/types
+++ b/bpkg/types
@@ -7,9 +7,9 @@
#include <vector>
#include <string>
+#include <ostream>
#include <butl/path>
-#include <butl/path-io>
namespace bpkg
{
@@ -29,6 +29,21 @@ namespace bpkg
using paths = std::vector<path>;
using dir_paths = std::vector<dir_path>;
+
+ inline std::ostream&
+ operator<< (std::ostream& os, const path& p) {return os << p.string ();}
+
+ inline std::ostream&
+ operator<< (std::ostream& os, const dir_path& p)
+ {
+ const string& s (p.string ());
+ os << s;
+
+ if (!s.empty () && !dir_path::traits::is_separator (s.back ()))
+ os << dir_path::traits::directory_separator;
+
+ return os;
+ }
}
#endif // BPKG_TYPES