aboutsummaryrefslogtreecommitdiff
path: root/build/path
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2015-02-20 09:29:56 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2015-02-20 09:29:56 +0200
commitc23346c4cda9e0c2318c302dc6014d3fef53a6d3 (patch)
tree2a24d82d2445a8adbdf6e88ef22a5ce4d1957a19 /build/path
parent8bd89cfca333e58f6990d7d168649dfc79878f31 (diff)
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'}.
Diffstat (limited to 'build/path')
-rw-r--r--build/path27
1 files changed, 27 insertions, 0 deletions
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)
{