next | previous | forward | backward | up | top | index | toc | Macaulay2 website
Macaulay2Doc > The Macaulay2 language > file manipulation > temporaryFileName

temporaryFileName -- make a temporary file name



The file name is so unique that even with various suffixes appended, no collision with existing files will occur. The files will be removed when the program terminates, unless it terminates as the result of an error.
i1 : temporaryFileName () | ".tex"

o1 = /tmp/M2-63449-0/0.tex
i2 : temporaryFileName () | ".html"

o2 = /tmp/M2-63449-0/1.html

This function will work under Unix, and also under Windows if you have a directory on the same drive called /tmp.

If the name of the temporary file will be given to an external program, it may be necessary to concatenate it with rootPath or rootURI to enable the external program to find the file.

The temporary file name is derived from the value of the environment variable TMPDIR, if it has one.

If fork is used, then the parent and child Macaulay2 processes will each remove their own temporary files upon termination, with the parent removing any files created before fork was called.

See also

For the programmer

The object temporaryFileName is a function closure.