mirror of
https://github.com/GothenburgBitFactory/taskwarrior.git
synced 2025-07-07 20:06:36 +02:00
TW-1873: Specify different path to extensions/hooks directory
- Thanks to Eli.
This commit is contained in:
parent
3c879e868a
commit
44522b11bc
6 changed files with 35 additions and 6 deletions
|
@ -532,7 +532,11 @@ void Config::createDefaultData (const std::string& data)
|
|||
|
||||
d.create ();
|
||||
|
||||
d += "hooks";
|
||||
if (has ("hooks.location"))
|
||||
d = Directory (get ("hooks.location"));
|
||||
else
|
||||
d += "hooks";
|
||||
|
||||
d.create ();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -54,9 +54,19 @@ void Hooks::initialize ()
|
|||
{
|
||||
_debug = context.config.getInteger ("debug.hooks");
|
||||
|
||||
// Scan <rc.data.location>/hooks
|
||||
Directory d (context.config.get ("data.location"));
|
||||
d += "hooks";
|
||||
// Scan <rc.hooks.location>
|
||||
// <rc.data.location>/hooks
|
||||
Directory d;
|
||||
if (context.config.has ("hooks.location"))
|
||||
{
|
||||
d = Directory (context.config.get ("hooks.location"));
|
||||
}
|
||||
else
|
||||
{
|
||||
d = Directory (context.config.get ("data.location"));
|
||||
d += "hooks";
|
||||
}
|
||||
|
||||
if (d.is_directory () &&
|
||||
d.readable ())
|
||||
{
|
||||
|
|
|
@ -307,8 +307,16 @@ int CmdDiagnostics::execute (std::string& output)
|
|||
<< "\n\n";
|
||||
|
||||
// Display hook status.
|
||||
Path hookLocation (context.config.get ("data.location"));
|
||||
hookLocation += "hooks";
|
||||
Path hookLocation;
|
||||
if (context.config.has ("hooks.location"))
|
||||
{
|
||||
hookLocation = Path (context.config.get ("hooks.location"));
|
||||
}
|
||||
else
|
||||
{
|
||||
hookLocation = Path (context.config.get ("data.location"));
|
||||
hookLocation += "hooks";
|
||||
}
|
||||
|
||||
out << bold.colorize (STRING_CMD_DIAG_HOOKS)
|
||||
<< '\n'
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue