diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-04 15:47:08 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2019-09-04 15:47:08 +0200 |
commit | 4b9494f8e8afc4a46a1780cb88090888b9b0b874 (patch) | |
tree | 29e927a1c0567fe4c625ac80df3c87aa56e049fd | |
parent | 69ed8e0c82e4965c9cdd96f6847e163f7a032842 (diff) |
Minor improvement to path_traits::find_extension()
-rw-r--r-- | libbutl/path.mxx | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libbutl/path.mxx b/libbutl/path.mxx index 685e15a..ca034c9 100644 --- a/libbutl/path.mxx +++ b/libbutl/path.mxx @@ -317,9 +317,12 @@ LIBBUTL_MODEXPORT namespace butl // Return the position of '.' or npos if there is no extension. // static size_type - find_extension (string_type const& s) + find_extension (string_type const& s, size_type n = string_type::npos) { - const C* r (find_extension (s.c_str (), s.size ())); + if (n == string_type::npos) + n = s.size (); + + const C* r (find_extension (s.c_str (), n)); return r != nullptr ? r - s.c_str () : string_type::npos; } |