mirror of
https://github.com/wesnoth/wesnoth
synced 2025-05-19 13:57:51 +00:00
filesystem::base_name(): use boost::filesystem::path::stem()
No need to reinvent the wheel.
This commit is contained in:
parent
4f225f56e0
commit
b34fac184e
@ -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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user