aboutsummaryrefslogtreecommitdiff
path: root/build2/bash/utility.hxx
diff options
context:
space:
mode:
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