diff options
Diffstat (limited to 'libs/pbd/basename.cc')
-rw-r--r-- | libs/pbd/basename.cc | 19 |
1 files changed, 6 insertions, 13 deletions
diff --git a/libs/pbd/basename.cc b/libs/pbd/basename.cc index a51e393b78..9beed93625 100644 --- a/libs/pbd/basename.cc +++ b/libs/pbd/basename.cc @@ -1,20 +1,13 @@ -#include <iostream> -#include <string.h> #include <pbd/basename.h> +#include <glibmm/miscutils.h> +using Glib::ustring; -// implement this using Glib::path_get_basename -std::string -PBD::basename_nosuffix (const std::string& str) +ustring +PBD::basename_nosuffix (ustring str) { - std::string::size_type slash = str.find_last_of ('/'); - std::string noslash; + ustring base = Glib::path_get_basename (str); - if (slash == std::string::npos) { - noslash = str; - } else { - noslash = str.substr (slash+1); - } + return base.substr (0, base.find_last_of ('.')); - return noslash.substr (0, noslash.find_last_of ('.')); } |