handle the $HOME (and similar) env var not being set

some environments like Jenkins doesn't always have a $HOME env var

@passy @sboudrias @kevva @stephenplusplus could use your opinion here.