Skip to content
Snippets Groups Projects
Commit e7a21ffb authored by Dmitri Naumov's avatar Dmitri Naumov
Browse files

Add extractBaseName() and extractBaseNameWithoutExtension().

Calling getFileNameFromPath() for now.
parent 52fc7153
No related branches found
No related tags found
No related merge requests found
......@@ -80,6 +80,16 @@ std::string getFileNameFromPath(const std::string &str, bool with_extension)
return file.substr(0,end);
}
std::string extractBaseName(std::string const& pathname)
{
return getFileNameFromPath(pathname, true);
}
std::string extractBaseNameWithoutExtension(std::string const& pathname)
{
return getFileNameFromPath(pathname, false);
}
std::string getSuffixFromPath(const std::string &path)
{
const std::string str = getFileNameFromPath(path, true);
......
......@@ -59,6 +59,16 @@ void truncateFile( std::string const& file_path);
*/
std::string getFileNameFromPath(const std::string &str, bool with_extension = false);
/**
* Extracts basename from given pathname with extension.
*/
std::string extractBaseName(std::string const& pathname);
/**
* Extracts basename from given pathname without its extension.
*/
std::string extractBaseNameWithoutExtension(std::string const& pathname);
/**
* Extract the file type / suffix from a path
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment