Returns the path to a directory for temporary files.
On Windows, this function returns the result of calling the Windows API
function
GetTempPath.
On POSIX platforms, it searches through the following list of directories and
returns the first one which is found to exist:
The directory given by the TMPDIR environment variable.
The directory given by the TEMP environment variable.
The directory given by the TMP environment variable.
/tmp
/var/tmp
/usr/tmp
On all platforms, tempDir returns "." on failure, representing the
current working directory.
The return value of the function is cached, so the procedures described above
will only be performed the first time the function is called. All subsequent
runs will return the same string, regardless of whether environment variables
and directory structures have changed in the meantime.
Returns the path to a directory for temporary files.
On Windows, this function returns the result of calling the Windows API function GetTempPath.
On POSIX platforms, it searches through the following list of directories and returns the first one which is found to exist:
On all platforms, tempDir returns "." on failure, representing the current working directory.
The return value of the function is cached, so the procedures described above will only be performed the first time the function is called. All subsequent runs will return the same string, regardless of whether environment variables and directory structures have changed in the meantime.
The POSIX tempDir algorithm is inspired by Python's tempfile.tempdir.