/* * $Id: Basename.cpp 144 2010-09-28 11:19:10Z rosiere $ * * [ Description ] * */ #include "../include/Basename.h" #include namespace morpheo { std::string basename (std::string str, bool keep_extension) { std::string res = ::basename(const_cast(str.c_str())); if (not keep_extension) { std::string::size_type index = res.rfind('.'); if(index != std::string::npos) { res = res.substr(0,index); } } return res; } }; // end namespace morpheo