filesystem::base_name(): use boost::filesystem::path::stem()

No need to reinvent the wheel.
This commit is contained in:
Jyrki Vesterinen 2017-10-24 19:22:39 +03:00
parent 4f225f56e0
commit b34fac184e

View file

@ -948,13 +948,11 @@ int dir_size(const std::string& pname)
std::string base_name(const std::string& file, const bool remove_extension)
{
std::string res = path(file).filename().string();
if(remove_extension) {
return res.substr(0, res.rfind("."));
if(!remove_extension) {
return path(file).filename().string();
} else {
return path(file).stem().string();
}
return res;
}
std::string directory_name(const std::string& file)