TW-1705: Directories in .task/hooks should not be reported as invalid hooks

- Thanks to Tomas Babej.
This commit is contained in:
Paul Beckingham
2016-01-11 22:30:35 -05:00
parent 19f57ffead
commit 60667dbcaa
3 changed files with 49 additions and 39 deletions

View File

@@ -71,14 +71,17 @@ void Hooks::initialize ()
for (auto& i : _scripts)
{
Path p (i);
std::string name = p.name ();
if (name.substr (0, 6) == "on-add" ||
name.substr (0, 9) == "on-modify" ||
name.substr (0, 9) == "on-launch" ||
name.substr (0, 7) == "on-exit")
context.debug ("Found hook script " + i);
else
context.debug ("Found misnamed hook script " + i);
if (! p.is_directory ())
{
std::string name = p.name ();
if (name.substr (0, 6) == "on-add" ||
name.substr (0, 9) == "on-modify" ||
name.substr (0, 9) == "on-launch" ||
name.substr (0, 7) == "on-exit")
context.debug ("Found hook script " + i);
else
context.debug ("Found misnamed hook script " + i);
}
}
}
}