19.1. Pathname Components [sec_19-2-1]

19.1.1. Directory canonicalization
19.1.2. Platform-specific issues

When a pathname is to be fully specified (no wildcards), that means that no :WILD, :WILD-INFERIORS is allowed, no wildcard characters are allowed in the strings, and name EQ NIL may not be allowed either.

19.1.1. Directory canonicalization

As permitted by the MAKE-PATHNAME specification, the PATHNAME directory component is canonicalized when the pathname is constructed:

  1. "" and "." are removed
  2. "..", "*", and "**" are converted to :UP, :WILD and :WILD-INFERIORS, respectively
  3. patterns foo/../ are collapsed

19.1.2. Platform-specific issues

Platform Dependent: UNIX platform only.

Pathname components

host
always NIL
device
always NIL
directory = (startpoint . subdirs)
elementvaluesmeaning
startpoint:RELATIVE | :ABSOLUTE 
subdirs() | (subdir . subdirs) 
subdir:WILD-INFERIORS** or ..., all subdirectories
subdirSIMPLE-STRING, may contain wildcard characters "?" and "*" (may also be specified as :WILD) 
name
type
NIL or SIMPLE-STRING, may contain wildcard characters "?" and "*" (may also be specified as :WILD)
version
NIL or :WILD or :NEWEST (after merging the defaults)

A UNIX filename is split into name and type.

External notation: "server:sub1.typ/sub2.typ/name.typ"
using defaults: "sub1.typ/sub2.typ/name.typ"
or "name.typ"
or "sub1.typ/**/sub3.typ/x*.lisp"
or similar. 
Platform Dependent: Win32 platform only.

Pathname components

host
NIL or SIMPLE-STRING, wildcard characters may occur but do not act as wildcards
device
NIL or :WILD or A|...|Z
directory = (startpoint . subdirs)
elementvaluesmeaning
startpoint:RELATIVE | :ABSOLUTE 
subdirs() | (subdir . subdirs) 
subdir:WILD-INFERIORS** or ..., all subdirectories
subdirSIMPLE-STRING, may contain wildcard characters "?" and "*" (may also be specified as :WILD) 
name
type
NIL or SIMPLE-STRING, may contain wildcard characters "?" and "*" (may also be specified as :WILD)
version
NIL or :WILD or :NEWEST (after merging the defaults)

If host is non-NIL, device must be NIL.

A Win32 filename is split into name and type.

External notation:"A:\sub1.typ\sub2.typ\name.typ"
using defaults: "\sub1.typ\sub2.typ\name.typ"
or "name.typ"
or"*:\sub1.typ\**\sub3.typ\x*.lisp"
or similar. 

Instead of "\" one may use "/", as usual for DOS calls.

If host is non-NIL and the directory's startpoint is not :ABSOLUTE, (PARSE-NAMESTRING (NAMESTRING pathname)) will not be the same as pathname.

Platform Dependent: UNIX, Win32 platforms only.
The wildcard characters: "*" matches any sequence of characters, "?" matches any one character.

Name/type namestring split. 

Platform Dependent: UNIX, Win32 platforms only.

A filename is split into name and type according to the following rule:

  • if there is no "." in the filename, then the name is everything, type is NIL;
  • if there is a ".", then name is the part before and type the part after the last dot.
  • if the only "." is the first character, then the behavior depends on the value of the user variable CUSTOM:*PARSE-NAMESTRING-DOT-FILE* which can be either

    :TYPE
    NIL name, everything after the "." is the type; or
    :NAME
    NIL type, everything is the name

Note

Due to this name/type splitting rule, there are pathnames that cannot result from PARSE-NAMESTRING. To get a pathname whose type contains a dot or whose name contains a dot and whose type is NIL, MAKE-PATHNAME must be used. Example: (MAKE-PATHNAME :NAME "foo.bar").


These notes document CLISP version 2.49.93+Last modified: 2018-02-19