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
This commit is contained in:
Tim Mayberry 2007-09-04 09:01:15 +00:00
parent 26c4c12fb7
commit 4cf84efe88
2 changed files with 13 additions and 3 deletions

View file

@ -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