diff options
author | Paul Davis <paul@linuxaudiosystems.com> | 2006-12-21 18:38:00 +0000 |
---|---|---|
committer | Paul Davis <paul@linuxaudiosystems.com> | 2006-12-21 18:38:00 +0000 |
commit | afa29d319007ce20bd1546c343e9277c58c80c1a (patch) | |
tree | 0e1b3ec3bca91a16f3698077031d3872cdcbe96e /libs/pbd/basename.cc | |
parent | 2202912d355fc6f978bd3475c4c1b5cd1a435242 (diff) |
use ustring more; handle embedding of "paired" files as per mantis #1362
git-svn-id: svn://localhost/ardour2/trunk@1241 d708f5d6-7413-0410-9779-e7cbd77b26cf
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 ('.')); } |