aboutsummaryrefslogtreecommitdiff
path: root/build2/bash/utility.hxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-20 15:31:13 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-20 16:10:26 +0200
commitc1dc06dfd1d329f8c6499dbe2166725ab9c35e17 (patch)
tree97449ae7263490473a833944cfeb3d889a2f580d /build2/bash/utility.hxx
parentb4286df8c9bafdab1934cef99ccc0506ec4555e2 (diff)
Implement bash module
Diffstat (limited to 'build2/bash/utility.hxx')
-rw-r--r--build2/bash/utility.hxx28
1 files changed, 28 insertions, 0 deletions
diff --git a/build2/bash/utility.hxx b/build2/bash/utility.hxx
new file mode 100644
index 0000000..d8d9a43
--- /dev/null
+++ b/build2/bash/utility.hxx
@@ -0,0 +1,28 @@
+// file : build2/bash/utility.hxx -*- C++ -*-
+// copyright : Copyright (c) 2014-2018 Code Synthesis Ltd
+// license : MIT; see accompanying LICENSE file
+
+#ifndef BUILD2_BASH_UTILITY_HXX
+#define BUILD2_BASH_UTILITY_HXX
+
+#include <build2/types.hxx>
+#include <build2/utility.hxx>
+
+namespace build2
+{
+ namespace bash
+ {
+ // Strip the .bash extension from the project name.
+ //
+ inline string
+ project_base (const string& n)
+ {
+ size_t p (path::traits::find_extension (n));
+ return p == string::npos || casecmp (n.c_str () + p, ".bash", 5) != 0
+ ? n
+ : string (n, 0, p);
+ }
+ }
+}
+
+#endif // BUILD2_BASH_UTILITY_HXX