Search code examples
directorytcltemp

Tcl: [file tempdir]


Somehow in tcl 8.6:

  • file tempdir - is missing
  • file tempfile - is present

Question: why there is no tempdir ?


Solution

  • There's no file tempdir because there wasn't a sufficiently pressing need for someone to code it up, whereas temporary files are much more pressing (and harder to get right, especially across operating systems). You can always use tcllib as well as Tcl as they're under identical licenses; that library of Tcl-scripted packages provides a fileutil package that has this command:

    set dirname [fileutil::maketempdir]
    

    which should be plenty adequate. (There's a bunch of options available to cover most needs.)