aboutsummaryrefslogtreecommitdiff
path: root/build/target.cxx
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/target.cxx
parent534f9d8db025d58c9ce23f3b81a37e8c34386a27 (diff)
Add separate type to represent directory paths
Diffstat (limited to 'build/target.cxx')
-rw-r--r--build/target.cxx38
1 files changed, 19 insertions, 19 deletions
diff --git a/build/target.cxx b/build/target.cxx
index 4f49206..db02979 100644
--- a/build/target.cxx
+++ b/build/target.cxx
@@ -105,7 +105,7 @@ namespace build
pair<target&, bool> target_set::
insert (const target_type& tt,
- path dir,
+ dir_path dir,
std::string name,
const std::string* ext,
tracer& trace)
@@ -127,26 +127,26 @@ namespace build
ostream&
operator<< (ostream& os, const target_key& k)
{
+ // If the name is empty, then we want to print the directory
+ // inside {}, e.g., dir{bar/}, not bar/dir{}.
+ //
+ bool n (!k.name->empty ());
+ string d (diag_relative (*k.dir, false));
+
+ if (n)
+ os << d;
+
os << k.type->name << '{';
- if (!k.dir->empty ())
+ if (n)
{
- string s (diag_relative (*k.dir));
-
- if (s != ".")
- {
- os << s;
+ os << *k.name;
- if (!k.name->empty () &&
- s.back () != path::traits::directory_separator)
- os << path::traits::directory_separator;
- }
+ if (*k.ext != nullptr && !(*k.ext)->empty ())
+ os << '.' << **k.ext;
}
-
- os << *k.name;
-
- if (*k.ext != nullptr && !(*k.ext)->empty ())
- os << '.' << **k.ext;
+ else
+ os << d;
os << '}';
@@ -197,7 +197,7 @@ namespace build
//
if (!v.empty ())
{
- n.dir /= path (v); // Move name value to dir.
+ n.dir /= dir_path (v); // Move name value to dir.
v.clear ();
}
}
@@ -212,7 +212,7 @@ namespace build
if (i != string::npos)
{
- n.dir /= path (v, i != 0 ? i : 1); // Special case: "/".
+ n.dir /= dir_path (v, i != 0 ? i : 1); // Special case: "/".
v = string (v, i + 1, string::npos);
}
@@ -255,7 +255,7 @@ namespace build
//
if (p.dir.relative ())
{
- paths sp;
+ dir_paths sp;
sp.push_back (src_out (p.scope.path (), p.scope)); // src_base
return search_existing_file (p, sp);