Re-introduce tmpdir() and homedir(), update chdir()

The original idea behind unifying them into a single chdir() usage, becomes
very cumbersome in the implementation.  Therefore we're going back to these
functions.