Skip to content

Commit

Permalink
Fix the bug in FGPropertyNode::GetFullyQualifiedName.
Browse files Browse the repository at this point in the history
  • Loading branch information
bcoconni committed Oct 29, 2022
1 parent 4ed723d commit 0172378
Showing 1 changed file with 9 additions and 19 deletions.
28 changes: 9 additions & 19 deletions src/input_output/FGPropertyManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,26 +134,16 @@ string FGPropertyNode::GetPrintableName( void ) const

string FGPropertyNode::GetFullyQualifiedName(void) const
{
vector<string> 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<size_t>(1, fqname.size()-1);
return fqname.substr(0, len);
}

//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Expand Down

0 comments on commit 0172378

Please # to comment.