Fixed cppcheck warning
This commit is contained in:
@@ -178,9 +178,18 @@ replace_extension( std::string& _s, const std::string& _e )
|
|||||||
{
|
{
|
||||||
std::string::size_type dot = _s.rfind(".");
|
std::string::size_type dot = _s.rfind(".");
|
||||||
if (dot == std::string::npos)
|
if (dot == std::string::npos)
|
||||||
{ _s += "." + _e; }
|
{
|
||||||
|
// The name does not include a dot and therefore no extension. Adding both.
|
||||||
|
_s += "." + _e;
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{ _s = _s.substr(0,dot+1)+_e; }
|
{
|
||||||
|
// get everything of the name including the dot but remove the extension.
|
||||||
|
const std::string name = _s.substr(0,dot+1);
|
||||||
|
|
||||||
|
// Add the new extenion
|
||||||
|
_s = name + _e;
|
||||||
|
}
|
||||||
return _s;
|
return _s;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user