Availability:built-in
tmp_directory(+Base,
-Directory)Create a new directory Directory for temporary files.
Base is used as for tmp_file/2
and the directory is created in the directory defined by the Prolog flag tmp_dir.
The directory is only accessible to the current user. Unlike tmp_file/2,
this predicate creates the directory and, if the generated name already
exists, tries a new name. It is thus safe if multiple processes create
temporary directories concurrently.
If the Prolog process terminates gracefully, Directory
is removed if it is empty after removing the temporary files, including
those created by tmp_file_stream/3
inside Directory. Removing the content is the responsibility
of the application, for example using delete_directory_and_contents/1
from
library(filesex).
- Introduced in 10.1.21 (👉01dbb5e) tmp_directory/2 to create a temporary directory