Common Lisp the Language, 2nd Edition

Next: Pathnames Up: File System Interface Previous: File System Interface

# 23.1. File Names

Common Lisp programs need to use names to designate files. The main difficulty in dealing with names of files is that different file systems have different naming formats for files. For example, here is a table of several file systems (actually, operating systems that provide file systems) and what equivalent file names might look like for each one:

    System          File Name
    ==================================================
    TOPS-20         <LISPIO>FORMAT.FASL.13
    TOPS-10         FORMAT.FAS[1,4]
    ITS             LISPIO;FORMAT FASL
    MULTICS         >udd>LispIO>format.fasl
    TENEX           <LISPIO>FORMAT.FASL;13
    VAX/VMS         [LISPIO]FORMAT.FAS;13
    UNIX            /usr/lispio/format.fasl
    ==================================================

It would be impossible for each program that deals with file names to know about each different file name format that exists; a new Common Lisp implementation might use a format different from any of its predecessors. Therefore, Common Lisp provides two ways to represent file names: namestrings, which are strings in the implementation-dependent form customary for the file system, and pathnames, which are special abstract data objects that represent file names in an implementation-independent way. Functions are provided to convert between these two representations, and all manipulations of files can be expressed in machine-independent terms by using pathnames.

In order to allow Common Lisp programs to operate in a network environment that may have more than one kind of file system, the pathname facility allows a file name to specify which file system is to be used. In this context, each file system is called a host, in keeping with the usual networking terminology.

Different hosts may use different notations for file names. Common Lisp allows customary notation to be used for each host, but also supports a system of logical pathnames that provides a standard framework for naming files in a portable manner (see section 23.1.5).

- Pathnames
- Case Conventions
- Structured Directories
- Extended Wildcards
- Logical Pathnames
  - Syntax of Logical Pathname Namestrings
  - Parsing of Logical Pathname Namestrings
  - Using Logical Pathnames
  - Examples of the Use of Logical Pathnames
  - Discussion of Logical Pathnames
- Pathname Functions

Next: Pathnames Up: File System Interface Previous: File System Interface