- Code cleanup of ::findBinary.
This commit is contained in:
Paul Beckingham 2014-08-24 13:21:51 -04:00
parent f898953a2e
commit 0a4dcc1a21

View file

@ -329,8 +329,7 @@ void Parser::collect (
} }
//////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////
// Locate and tag the binary. It is assumed that the binary is the first // Locate and tag the binary. Simply look at the top-level, first branch.
// argument, which is valid.
void Parser::findBinary () void Parser::findBinary ()
{ {
if (_tree->_branches.size () >= 1) if (_tree->_branches.size () >= 1)
@ -340,20 +339,14 @@ void Parser::findBinary ()
std::string binary = _tree->_branches[0]->attribute ("raw"); std::string binary = _tree->_branches[0]->attribute ("raw");
std::string::size_type slash = binary.rfind ('/'); std::string::size_type slash = binary.rfind ('/');
if (slash != std::string::npos) if (slash != std::string::npos)
{
binary = binary.substr (slash + 1); binary = binary.substr (slash + 1);
}
_tree->_branches[0]->attribute ("basename", binary); _tree->_branches[0]->attribute ("basename", binary);
if (binary == "cal" || binary == "calendar") if (binary == "cal" || binary == "calendar")
{
_tree->_branches[0]->tag ("CALENDAR"); _tree->_branches[0]->tag ("CALENDAR");
}
else if (binary == "task" || binary == "tw" || binary == "t") else if (binary == "task" || binary == "tw" || binary == "t")
{
_tree->_branches[0]->tag ("TW"); _tree->_branches[0]->tag ("TW");
}
} }
} }