Add ability to use a custom temp directory

This should allows developers to change the default temporary files directory.