From 4389345ab6ad396a9597c0a67193d366ff8e9acd Mon Sep 17 00:00:00 2001 From: Dmitri Naumov <dmitri.naumov@ufz.de> Date: Tue, 30 Oct 2012 18:20:15 +0100 Subject: [PATCH] Correct getSuffixFromPath(). --- BaseLib/FileTools.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BaseLib/FileTools.cpp b/BaseLib/FileTools.cpp index b37dc9603de..2146cfb8e75 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); } -- GitLab