aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/target.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'libbuild2/target.cxx')
-rw-r--r--libbuild2/target.cxx29
1 files changed, 19 insertions, 10 deletions
diff --git a/libbuild2/target.cxx b/libbuild2/target.cxx
index 0b67dc3..34f3f72 100644
--- a/libbuild2/target.cxx
+++ b/libbuild2/target.cxx
@@ -678,6 +678,15 @@ namespace build2
const path& path_target::
derive_path (const char* de, const char* np, const char* ns, const char* ee)
{
+ return derive_path_with_extension (derive_extension (de), np, ns, ee);
+ }
+
+ const path& path_target::
+ derive_path_with_extension (const string& e,
+ const char* np,
+ const char* ns,
+ const char* ee)
+ {
path_type p (dir);
if (np == nullptr || np[0] == '\0')
@@ -691,22 +700,22 @@ namespace build2
if (ns != nullptr)
p += ns;
- return derive_path (move (p), de, ee);
+ return derive_path_with_extension (move (p), e, ee);
}
const path& path_target::
derive_path (path_type p, const char* de, const char* ee)
{
- // Derive and add the extension if any.
- //
- {
- const string& e (derive_extension (de));
+ return derive_path_with_extension (move (p), derive_extension (de), ee);
+ }
- if (!e.empty ())
- {
- p += '.';
- p += e;
- }
+ const path& path_target::
+ derive_path_with_extension (path_type p, const string& e, const char* ee)
+ {
+ if (!e.empty ())
+ {
+ p += '.';
+ p += e;
}
if (ee != nullptr)