Correctly set hook_file in run_hooks

The code was setting the $hook_file variable to
$dotfiles_dir/hooks/$when-$direction outside of the loop which actually
sets the $dotfiles_dir variable to each of the dotfiles directories
being processed in turn. This would lead to (for example) /hooks/post-up
which is not correct.

The fix is to move that logic into the loop.