diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp index b37dc9603de412e6471ab920f5b799afc6778fa4..2146cfb8e7553e7a8beb8a7ab9d1ebff8ca50117 100644 --- a/BaseLib/FileTools.cpp +++ b/BaseLib/FileTools.cpp @@ -80,9 +80,12 @@ std::string getFileNameFromPath(const std::string &str, bool with_extension) return file.substr(0,end); } -std::string getSuffixFromPath(const std::string &str) +std::string getSuffixFromPath(const std::string &path) { + const std::string str = getFileNameFromPath(path, true); std::string::size_type beg(str.find_last_of('.')); + if (beg == std::string::npos) + return std::string(); return str.substr(beg+1, str.length()-beg-1); }