aboutsummaryrefslogtreecommitdiff
path: root/build/path-io
blob: accdb94e7160db575e35ba858faac2c241df6a7b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
// file      : build/path-io -*- C++ -*-
// copyright : Copyright (c) 2014-2015 Code Synthesis Tools CC
// license   : MIT; see accompanying LICENSE file

#ifndef BUILD_PATH_IO
#define BUILD_PATH_IO

#include <ostream>

#include <build/path>

namespace build
{
  inline std::ostream&
  operator<< (std::ostream& os, const path& p)
  {
    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;
  }
}

#endif // BUILD_PATH_IO