Implement substitution of ~ to $HOME