From c23346c4cda9e0c2318c302dc6014d3fef53a6d3 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Fri, 20 Feb 2015 09:29:56 +0200 Subject: Rework extension handling logic We no longer support hxx{vector.}. Rather, the target type can decide, e.g., based on a config variable, whether to append an extension. Also, in the future we may support a syntax to specify that this is a complete name, e.g., hxx{'vector'}. --- build/path | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) (limited to 'build/path') diff --git a/build/path b/build/path index 8eb560b..9b3668d 100644 --- a/build/path +++ b/build/path @@ -74,6 +74,33 @@ namespace build return string_type::npos; } + static size_type + find_extension (string_type const& s) + { + size_type i (s.size ()); + + for (; i > 0; --i) + { + C c (s[i - 1]); + + if (c == '.') + break; + + if (is_separator (c)) + { + i = 0; + break; + } + } + + // Weed out paths like ".txt" (and "/.txt") and "txt.". + // + if (i > 1 && !is_separator (s[i - 2]) && i != s.size ()) + return i - 1; + else + return string_type::npos; + } + static int compare (string_type const& l, string_type const& r) { -- cgit v1.1