diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-07 14:59:07 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2018-08-07 19:32:10 +0200 |
commit | c2b4305349ca855c497904282db354de56c74842 (patch) | |
tree | 13ff2901d1ab491d930f81cee6fa49e5cff11577 /build2/b.cxx | |
parent | 7149c8eaeec3efcfc9da0f89c9ae979ff2c07fd5 (diff) |
Add support for default extension specification, trailing dot escaping
For example:
cxx{*}: extension = cxx
cxx{foo} # foo.cxx
cxx{foo.test} # foo.test (probably what we want...)
cxx{foo.test...} # foo.test.cxx (... is this)
cxx{foo..} # foo.
cxx{foo....} # foo..
cxx{foo.....} # error (must come in escape pair)
Diffstat (limited to 'build2/b.cxx')
-rw-r--r-- | build2/b.cxx | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/build2/b.cxx b/build2/b.cxx index de4ee0c..aedda7f 100644 --- a/build2/b.cxx +++ b/build2/b.cxx @@ -694,8 +694,9 @@ main (int argc, char* argv[]) const string& v (tn.value); // Handle a few common cases as special: empty name, '.', '..', as - // well as dir{foo/bar} (without trailing '/'). This code must be - // consistent with find_target_type() and other places. + // well as dir{foo/bar} (without trailing '/'). This logic must be + // consistent with find_target_type() and other places (grep for + // ".."). // if (v.empty () || v == "." || v == ".." || tn.type == "dir") out_base = dir_path (v); @@ -1274,10 +1275,11 @@ main (int argc, char* argv[]) // Find the target type and extract the extension. // - optional<string> e; - const target_type* ti (bs.find_target_type (tn, e, l)); + auto rp (bs.find_target_type (tn, l)); + const target_type* tt (rp.first); + optional<string>& e (rp.second); - if (ti == nullptr) + if (tt == nullptr) fail (l) << "unknown target type " << tn.type; if (mif->search != nullptr) @@ -1303,7 +1305,7 @@ main (int argc, char* argv[]) mif->search (mparams, rs, bs, - target_key {ti, &d, &out, &tn.value, e}, + target_key {tt, &d, &out, &tn.value, e}, l, tgs); } |