diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-04 14:13:25 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2015-09-04 14:13:25 +0200 |
commit | 06dc23bd590d003eca6109890974ca96ed6fd1a4 (patch) | |
tree | de30f230d9d34b0451c0e8807cdb148021e76f04 | |
parent | 94c3574492b6db6ae8d5fbef717f8e6f92f1d402 (diff) |
Print dir_path with trailing slash
-rw-r--r-- | bpkg/types | 17 |
1 files changed, 16 insertions, 1 deletions
@@ -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 |