diff --git a/src/input_output/FGPropertyManager.cpp b/src/input_output/FGPropertyManager.cpp index 9ec56b539f..0fc7c64c76 100644 --- a/src/input_output/FGPropertyManager.cpp +++ b/src/input_output/FGPropertyManager.cpp @@ -134,26 +134,16 @@ string FGPropertyNode::GetPrintableName( void ) const string FGPropertyNode::GetFullyQualifiedName(void) const { - vector stack; - stack.push_back( getDisplayName(true) ); - const SGPropertyNode* tmpn=getParent(); - bool atroot=false; - while( !atroot ) { - stack.push_back( tmpn->getDisplayName(true) ); - if( !tmpn->getParent() ) - atroot=true; - else - tmpn=tmpn->getParent(); - } - - string fqname=""; - for(size_t i=stack.size()-1;i>0;i--) { - fqname+= stack[i]; - fqname+= "/"; - } - fqname+= stack[0]; - return fqname; + string fqname; + const SGPropertyNode* node = this; + while(node) { + fqname = node->getDisplayName(true) + "/" + fqname; + node = node->getParent(); + } + // Remove the trailing slash if the node is not the root. + size_t len = std::max(1, fqname.size()-1); + return fqname.substr(0, len); } //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%