Fix undefined variable $dir

* Follow-up to 7f440c3f728d29a.
* Use __DIR__ everywhere.

Change-Id: If4ff55920207ba69dc4d981a68598e0a1eb029e4