From afa29d319007ce20bd1546c343e9277c58c80c1a Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Thu, 21 Dec 2006 18:38:00 +0000 Subject: 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 --- libs/pbd/basename.cc | 19 ++++++------------- 1 file changed, 6 insertions(+), 13 deletions(-) (limited to 'libs/pbd/basename.cc') 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 -#include #include +#include +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 ('.')); } -- cgit v1.2.3