diff options
Diffstat (limited to 'Source/cmSystemTools.cxx')
-rw-r--r-- | Source/cmSystemTools.cxx | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 4d9bf11..29d96ea 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -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). |