The temporary-file Reference Manual

This is the temporary-file Reference Manual, generated automatically by Declt version 4.0 beta 2 "William Riker" on Sun Sep 15 06:53:00 2024 GMT+0.

Table of Contents


1 Introduction


2 Systems

The main system appears first, followed by any subsystem dependency.


2.1 temporary-file

Temporary file creation library

Author

Hans Hübner <>

License

BSD

Dependencies
  • alexandria (system).
  • bordeaux-threads (system).
  • cl-fad (system).
  • cl-ppcre (system).
  • unit-test (system).
Source

temporary-file.asd.

Child Component

temporary-file.lisp (file).


3 Files

Files are sorted by type and then listed depth-first from the systems components trees.


3.1 Lisp


3.1.1 temporary-file/temporary-file.asd

Source

temporary-file.asd.

Parent Component

temporary-file (system).

ASDF Systems

temporary-file.


3.1.2 temporary-file/temporary-file.lisp

Source

temporary-file.asd.

Parent Component

temporary-file (system).

Packages

temporary-file.

Public Interface
Internals

4 Packages

Packages are listed by definition order.


4.1 temporary-file

Source

temporary-file.lisp.

Use List

common-lisp.

Public Interface
Internals

5 Definitions

Definitions are sorted by export status, category, package, and then by lexicographic order.


5.1 Public Interface


5.1.1 Special variables

Special Variable: *default-template*
Package

temporary-file.

Source

temporary-file.lisp.


5.1.2 Macros

Macro: with-open-temporary-file ((stream &rest args &key keep &allow-other-keys) &body body)

Create a temporary file using OPEN-TEMPORARY with ARGS and run BODY with STREAM bound to the temporary file stream. Returns the values returned by BODY. By default, the file is deleted when BODY is exited. If a true value is passed in KEEP, the file is not deleted when the body is exited. See OPEN-TEMPORARY for more permitted options.

Package

temporary-file.

Source

temporary-file.lisp.

Macro: with-output-to-temporary-file ((stream &rest args) &body body)

Create a temporary file using OPEN-TEMPORARY with ARGS and run BODY with STREAM bound to the temporary file stream. Returns the pathname of the file that has been created. See OPEN-TEMPORARY for permitted options.

Package

temporary-file.

Source

temporary-file.lisp.


5.1.3 Ordinary functions

Function: open-temporary (&rest open-arguments &key template generate-random-string max-tries direction &allow-other-keys)

Create a file with a randomly generated name and return the opened stream. The resulting pathname is generated from TEMPLATE, which is a string representing a pathname template. A percent sign (%) in that string is replaced by a randomly generated string to make the filename unique. The default for TEMPLATE places temporary files in the TEMPORARY-FILES logical pathname host, which is automatically set up in a system specific manner. The file name generated from TEMPLATE is merged with *DEFAULT-PATHNAME-DEFAULTS*, so random pathnames relative to that directory can be generated by not specifying a directory in TEMPLATE.

GENERATE-RANDOM-STRING can be passed to override the default function that generates the random name component. It should return a random string consisting of characters that are permitted in a pathname (logical or physical, depending on TEMPLATE).

The name of the temporary file can be accessed calling the PATHNAME function on STREAM. For convenience, the temporary file is opened on the physical pathname, i.e. if the TEMPLATE designate a logical pathname the translation to a physical pathname is performed before opening the stream.

In order to create a unique file name, OPEN-TEMPORARY may loop internally up to MAX-TRIES times before giving up and signalling a CANNOT-CREATE-TEMPORARY-FILE condition.

Package

temporary-file.

Source

temporary-file.lisp.


5.1.4 Conditions

Condition: cannot-create-temporary-file
Package

temporary-file.

Source

temporary-file.lisp.

Direct superclasses

error.

Direct slots
Slot: template
Initargs

:template

Slot: max-tries
Initargs

:max-tries

Condition: invalid-temporary-pathname-template
Package

temporary-file.

Source

temporary-file.lisp.

Direct superclasses

error.

Direct slots
Slot: string
Package

common-lisp.

Initargs

:string


5.2 Internals


5.2.1 Special variables

Special Variable: *create-file-name-lock*
Package

temporary-file.

Source

temporary-file.lisp.

Special Variable: *max-tries*
Package

temporary-file.

Source

temporary-file.lisp.

Special Variable: *name-random-state*
Package

temporary-file.

Source

temporary-file.lisp.


5.2.2 Macros

Macro: with-file-name-lock-held (() &body body)
Package

temporary-file.

Source

temporary-file.lisp.


5.2.3 Ordinary functions

Function: directory-from-environment (environment-variable-name)
Package

temporary-file.

Source

temporary-file.lisp.

Function: generate-random-pathname (template random-string-generator)
Package

temporary-file.

Source

temporary-file.lisp.

Function: generate-random-string ()
Package

temporary-file.

Source

temporary-file.lisp.

Function: get-default-temporary-directory ()
Package

temporary-file.

Source

temporary-file.lisp.

Function: getenv (x)

Query the libc runtime environment. See getenv(3).

Package

temporary-file.

Source

temporary-file.lisp.


Appendix A Indexes


A.1 Concepts