summaryrefslogtreecommitdiff
path: root/libs/pbd/filesystem.cc
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-09-04 09:01:15 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-09-04 09:01:15 +0000
commit4cf84efe8896d7be295993418bbde9e5d3c0cfee (patch)
tree71037ff1fb67b7424524aed2db0779996558ddf1 /libs/pbd/filesystem.cc
parent26c4c12fb79e40f908b0357a063bb94d104f9f69 (diff)
Modify PBD::sys::basename to match boost::filesystem behaviour and document it.
This makes this function equivalent to PBD::basename_nosuffix, sys::basename takes a path as an argument rather than a string but that is ok as a path can automatically constructed from a string. git-svn-id: svn://localhost/ardour2/trunk@2404 d708f5d6-7413-0410-9779-e7cbd77b26cf
Diffstat (limited to 'libs/pbd/filesystem.cc')
-rw-r--r--libs/pbd/filesystem.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/libs/pbd/filesystem.cc b/libs/pbd/filesystem.cc
index 6aaaec1d81..ea45b1da44 100644
--- a/libs/pbd/filesystem.cc
+++ b/libs/pbd/filesystem.cc
@@ -155,8 +155,11 @@ copy_file(const path & from_path, const path & to_path)
string
basename (const path & p)
{
- // I'm not sure if this works quite the same as boost::filesystem::basename
- return Glib::path_get_basename (p.to_string ());
+ string base = Glib::path_get_basename (p.to_string());
+
+ string::size_type n = base.rfind ('.');
+
+ return base.substr (0, n);
}
} // namespace sys