aboutsummaryrefslogtreecommitdiff
path: root/build2/target.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'build2/target.cxx')
-rw-r--r--build2/target.cxx17
1 files changed, 10 insertions, 7 deletions
diff --git a/build2/target.cxx b/build2/target.cxx
index 7a33dbc..8541deb 100644
--- a/build2/target.cxx
+++ b/build2/target.cxx
@@ -351,17 +351,20 @@ namespace build2
const path& path_target::
derive_path (const char* de, const char* np, const char* ns)
{
- string n;
+ path_type p (dir);
- if (np != nullptr)
- n += np;
-
- n += name;
+ if (np == nullptr)
+ p /= name;
+ else
+ {
+ p /= np;
+ p += name;
+ }
if (ns != nullptr)
- n += ns;
+ p += ns;
- return derive_path (dir / path_type (move (n)), de);
+ return derive_path (move (p), de);
}
const path& path_target::