added shortest ext function
This commit is contained in:
parent
275b334f8b
commit
e3178eed97
|
@ -1247,6 +1247,23 @@ std::string cmSystemTools::GetFilenameExtension(const std::string& filename)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Return file extension of a full filename (dot included).
|
||||||
|
*/
|
||||||
|
std::string cmSystemTools::GetFilenameShortestExtension(const std::string& filename)
|
||||||
|
{
|
||||||
|
std::string name = cmSystemTools::GetFilenameName(filename);
|
||||||
|
std::string::size_type dot_pos = name.rfind(".");
|
||||||
|
if(dot_pos != std::string::npos)
|
||||||
|
{
|
||||||
|
return name.substr(dot_pos);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return "";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return file name without extension of a full filename (i.e. without path).
|
* Return file name without extension of a full filename (i.e. without path).
|
||||||
|
|
|
@ -242,6 +242,7 @@ public:
|
||||||
|
|
||||||
///! return file extension of a full filename (dot included).
|
///! return file extension of a full filename (dot included).
|
||||||
static std::string GetFilenameExtension(const std::string&);
|
static std::string GetFilenameExtension(const std::string&);
|
||||||
|
static std::string GetFilenameShortestExtension(const std::string&);
|
||||||
|
|
||||||
///! return file name without extension of a full filename.
|
///! return file name without extension of a full filename.
|
||||||
static std::string GetFilenameNameWithoutExtension(const std::string&);
|
static std::string GetFilenameNameWithoutExtension(const std::string&);
|
||||||
|
|
Loading…
Reference in New Issue