- ::onModify now conforms to design.
This commit is contained in:
Paul Beckingham 2014-05-14 21:44:22 -04:00
parent 0b6e94280e
commit b1c0e67581

View file

@ -70,13 +70,9 @@ void Hooks::onLaunch ()
{ {
context.timer_hooks.start (); context.timer_hooks.start ();
std::vector <std::string> matchingScripts = scripts ("on-launch");
std::vector <std::string>::iterator i; std::vector <std::string>::iterator i;
for (i = _scripts.begin (); i != _scripts.end (); ++i) for (i = matchingScripts.begin (); i != matchingScripts.end (); ++i)
{
if (i->find ("/on-launch") != std::string::npos)
{
File script (*i);
if (script.executable ())
{ {
std::string output; std::string output;
int status = execute (*i, "", output); int status = execute (*i, "", output);
@ -88,8 +84,16 @@ void Hooks::onLaunch ()
if (status == 0) if (status == 0)
{ {
for (line = lines.begin (); line != lines.end (); ++line) for (line = lines.begin (); line != lines.end (); ++line)
{
if (line->length () && (*line)[0] == '{')
{
Task newTask (*line);
context.tdb2.add (newTask);
}
else
context.header (*line); context.header (*line);
} }
}
else else
{ {
for (line = lines.begin (); line != lines.end (); ++line) for (line = lines.begin (); line != lines.end (); ++line)
@ -98,8 +102,6 @@ void Hooks::onLaunch ()
throw 0; // This is how hooks silently terminate processing. throw 0; // This is how hooks silently terminate processing.
} }
} }
}
}
context.timer_hooks.stop (); context.timer_hooks.stop ();
} }