From df4efffedae5117debbb5ba0f1479f1a53960a0d Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 7 Aug 2018 18:27:55 +0200 Subject: Fix --- build2/parser.cxx | 7 ++++++- build2/target.cxx | 4 ++-- build2/target.hxx | 5 ++++- 3 files changed, 12 insertions(+), 4 deletions(-) (limited to 'build2') diff --git a/build2/parser.cxx b/build2/parser.cxx index 25742d0..e10d940 100644 --- a/build2/parser.cxx +++ b/build2/parser.cxx @@ -3214,14 +3214,19 @@ namespace build2 } } + bool de (false); // Default extension. if ((n.pair & 0x01) != 0) + { + de = static_cast (e); tt->pattern (*tt, *scope_, v, e, true); + de = de && !e; + } if (dir) n.dir = dir_path (move (v)); else { - target::combine_name (v, e); + target::combine_name (v, e, de); n.value = move (v); } diff --git a/build2/target.cxx b/build2/target.cxx index ebc21db..b3f0fdc 100644 --- a/build2/target.cxx +++ b/build2/target.cxx @@ -240,7 +240,7 @@ namespace build2 } void target:: - combine_name (string& v, const optional& e) + combine_name (string& v, const optional& e, bool de) { if (v.back () == '.') { @@ -258,7 +258,7 @@ namespace build2 v += '.'; v += *e; // Empty or not. } - else + else if (de) { if (path::traits::find_extension (v) != string::npos) v += "..."; diff --git a/build2/target.hxx b/build2/target.hxx index 127940a..8014d42 100644 --- a/build2/target.hxx +++ b/build2/target.hxx @@ -656,8 +656,11 @@ namespace build2 // Combine the target name and extension into the name leaf. // + // If the target type has the default extension, then "escape" the + // existing extension if any. + // static void - combine_name (string&, const optional&); + combine_name (string&, const optional&, bool default_extension); public: virtual -- cgit v1.1