Esempio n. 1
0
std::string extractBaseName(std::string const& pathname)
{
    auto const p = findLastPathSeparator(pathname);
    if (p == std::string::npos)
        return pathname;
    return pathname.substr(p + 1);
}
Esempio n. 2
0
std::string copyPathToFileName(const std::string &file_name,
                               const std::string &source)
{
	// check if file_name already contains a full path
	const size_t pos = findLastPathSeparator(file_name);
	if (pos != std::string::npos)
		return file_name;

	return BaseLib::extractPath(source).append(file_name);
}
Esempio n. 3
0
std::string dropFileExtension(std::string const& filename)
{
	// Look for dots in filename.
	const size_t p = findLastDot(filename);
	if (p == std::string::npos)
		return filename;

	// Check position of the last path separator.
	const size_t s = findLastPathSeparator(filename);
	if (s != std::string::npos && p < s)
		return filename;

	return filename.substr(0, p);
}
Esempio n. 4
0
std::string extractBaseName(std::string const& pathname)
{
	const size_t p = findLastPathSeparator(pathname);
	return pathname.substr(p + 1);
}
Esempio n. 5
0
std::string extractPath(std::string const& pathname)
{
	const size_t pos = findLastPathSeparator(pathname);
	return pathname.substr(0, pos + 1);
}