summaryrefslogtreecommitdiff
path: root/libs/pbd3/basename.cc
blob: a51e393b78498845a671a60244a888b8a16a9e52 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
#include <iostream>
#include <string.h>
#include <pbd/basename.h>


// implement this using Glib::path_get_basename
std::string 
PBD::basename_nosuffix (const std::string& str)
{
	std::string::size_type slash = str.find_last_of ('/');
	std::string noslash;

	if (slash == std::string::npos) {
		noslash = str;
	} else {
		noslash = str.substr (slash+1);
	}

	return noslash.substr (0, noslash.find_last_of ('.'));
}