aboutsummaryrefslogtreecommitdiff
path: root/libbutl/project-name.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2018-07-30 11:15:58 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2018-07-30 11:15:58 +0200
commit6f120d5f670694a0d1bd8d9dd2a972c295e5daeb (patch)
treedcab1f48fcca53fc42c22e5c8548b065ad0a7c9e /libbutl/project-name.cxx
parenta31945f682fc69340692680f2736aa74c186ef69 (diff)
Extend project_name::base() to optionally restrict extension
Diffstat (limited to 'libbutl/project-name.cxx')
-rw-r--r--libbutl/project-name.cxx8
1 files changed, 7 insertions, 1 deletions
diff --git a/libbutl/project-name.cxx b/libbutl/project-name.cxx
index 5f94ea0..76a68b9 100644
--- a/libbutl/project-name.cxx
+++ b/libbutl/project-name.cxx
@@ -81,11 +81,17 @@ namespace butl
}
string project_name::
- base () const
+ base (const char* e) const
{
using std::string;
size_t p (path::traits::find_extension (value_));
+
+ if (e != nullptr &&
+ p != string::npos &&
+ casecmp (value_.c_str () + p + 1, e) != 0)
+ p = string::npos;
+
return string (value_, 0, p);
}