Pathname Designators. When CUSTOM:*PARSE-NAMESTRING-ANSI* is NIL, SYMBOL is also treated as a
pathname designator,
namely its SYMBOL-NAME is converted to the
operating system's preferred pathname case.
Function PATHNAME-MATCH-P. PATHNAME-MATCH-P does not interpret missing components as
wild.
TRANSLATE-PATHNAMETRANSLATE-PATHNAME accepts three additional keyword arguments:
(TRANSLATE-PATHNAME source
from-wildname
to-wildname &KEY :ALL
:MERGE :ABSOLUTE)
If :ALL is specified and non-NIL, a list of all resulting
pathnames, corresponding to all matches of (, is
returned.PATHNAME-MATCH-P
source from-wildname)
If :MERGE is specified and NIL, unspecified pieces of
to-pathname are not replaced by
corresponding pieces of source.
If :ABSOLUTE is specified and non-NIL, the returned
pathnames are converted to absolute by merging in the current process'
directory, therefore rendering pathnames suitable for the OS and
external programs. So, to pass a pathname to an external program, you
do ( or NAMESTRING (TRANSLATE-PATHNAME pathname
#P"" #P"" :ABSOLUTE T))(.NAMESTRING
(EXT:ABSOLUTE-PATHNAME pathname))
TRANSLATE-LOGICAL-PATHNAMETRANSLATE-LOGICAL-PATHNAME accepts an additional keyword
argument :ABSOLUTE, similar to Section 19.5.1, “Function TRANSLATE-PATHNAME”.
PARSE-NAMESTRING(
returns a logical pathname only if PARSE-NAMESTRING string &OPTIONAL
host defaults &KEY start end
junk-allowed)host is a
logical host
or host is NIL and defaults is a LOGICAL-PATHNAME.
To construct a logical pathname from a string, the function
LOGICAL-PATHNAME can be used.
The [ANSI CL standard] behavior of recognizing logical pathnames when
the string begins with some alphanumeric characters followed by a
colon (#\:) can be very confusing
(cf. "c:/autoexec.bat",
"home:.clisprc" and
"prep:/pub/gnu")
and therefore is disabled by default.
To enable the [ANSI CL standard] behavior, you should set CUSTOM:*PARSE-NAMESTRING-ANSI* to non-NIL.
Note that this also disables treating SYMBOLs as pathname designators.
MERGE-PATHNAMES( returns a
logical pathname only if
MERGE-PATHNAMES pathname
[default-pathname])default-pathname is a LOGICAL-PATHNAME.
To construct a logical pathname from a STRING, the function
LOGICAL-PATHNAME can be used.
When both pathname and default-pathname
are relative pathnames, the behavior depends on CUSTOM:*MERGE-PATHNAMES-ANSI*: when it is
NIL, then CLISP retains its traditional behavior:
(
evaluates to MERGE-PATHNAMES #P"x/" #P"y/")#P"x/"
Rationale. MERGE-PATHNAMES is used to specify default components for
pathnames, so there is some analogy between
( and
MERGE-PATHNAMES a b)(. Obviously, putting in the
same default a second time should do the same as putting it in once:
OR a b)( is the same as OR a b b)(, so
OR a b)(
should be the same as MERGE-PATHNAMES (MERGE-PATHNAMES a b) b)(.
MERGE-PATHNAMES a b)
(This question actually does matter because in Common Lisp there is no distinction between “pathnames with defaults merged-in” and “pathnames with defaults not yet applied”.)
Now, ( and MERGE-PATHNAMES (MERGE-PATHNAMES #P"x/" #P"y/")
#P"y/")( are
MERGE-PATHNAMES #P"x/" #P"y/")EQUAL in CLISP (when CUSTOM:*MERGE-PATHNAMES-ANSI* is NIL), but not in
implementations that strictly follow the [ANSI CL standard].
In fact, the above twice-default = once-default
rule holds for all pathnames in CLISP.
Conversely, when CUSTOM:*MERGE-PATHNAMES-ANSI* is non-NIL, the normal [ANSI CL standard]
behavior is exhibited: (
evaluates to MERGE-PATHNAMES #P"x/" #P"y/")#P"y/x/".
Rationale. “merge” is merge and not or.
LOAD-LOGICAL-PATHNAME-TRANSLATIONSWhen the host argument to LOAD-LOGICAL-PATHNAME-TRANSLATIONS
is not a defined logical host yet, we proceed as follows:
LOGICAL_HOST_host_FROM and
LOGICAL_HOST_host_TO exist, then their values
define the map of the host.LOGICAL_HOST_host exists, its value is read from,
and the result is passed to (SETF
LOGICAL-PATHNAME-TRANSLATIONS).CUSTOM:*LOAD-LOGICAL-PATHNAME-TRANSLATIONS-DATABASE* is consulted.
Its value should be a LIST of files and/or directories,
which are searched for in the CUSTOM:*LOAD-PATHS*, just like for LOAD.
When the element is a file, it is repeatedly READ from,
Allegro CL-style,
odd objects being host names and even object being their
LOGICAL-PATHNAME-TRANSLATIONS.
When the element is a directory, a file, named host
or host.host, in that directory, is READ
from once, CMUCL-style,
the object read being the LOGICAL-PATHNAME-TRANSLATIONS of the
host.EXT:ABSOLUTE-PATHNAME( converts the EXT:ABSOLUTE-PATHNAME pathname)pathname
to a physical pathname, then - if its directory component is not
absolute - converts it to an absolute pathname, by merging in the
current process' directory. This is like TRUENAME, except that it
does not verify that a file named by the pathname exists, not even that
its directory exists. It does no filesystem accesses, except to
determine the current directory. This function is useful when you want
to save a pathname over time, or pass a pathname to an external
program.
| These notes document CLISP version 2.49 | Last modified: 2010-07-07 |