Simplify logic of getting the temporary directory.