Allow tmp_dir to be user-configurable