/* * $Id: Basename.cpp 143 2010-09-02 14:33:08Z rosiere $ * * [ Description ] * */ #include "../include/Basename.h" #include namespace morpheo { std::string basename (std::string str, bool keep_extension) { std::string res = ::basename(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