diff --git a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc index a6940f62..2bccda5e 100644 --- a/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc +++ b/src/OpenMesh/Apps/VDProgMesh/mkbalancedpm/mkbalancedpm.cc @@ -178,9 +178,18 @@ replace_extension( std::string& _s, const std::string& _e ) { std::string::size_type dot = _s.rfind("."); if (dot == std::string::npos) - { _s += "." + _e; } + { + // The name does not include a dot and therefore no extension. Adding both. + _s += "." + _e; + } 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; }