CLISP has traditionally taken the view that a directory is a
separate object and not a special kind of file, so whenever the
standard says that a function operates on files
without specifically mentioning that it also works on
directories, CLISP SIGNAL
s an ERROR
when passed a
directory.
CLISP provides separate directory functions, such as
EXT:DELETE-DIRECTORY
, EXT:RENAME-DIRECTORY
et al.
You can use DIRECTORY
or EXT:PROBE-PATHNAME
to figure out whether a
given namestring refers to a file or a directory.
EXT:PROBE-PATHNAME
Function (
figures out whether the argument refers to an existing directory or an
existing regular file, and returns 4 values
if the filesystem object exists: EXT:PROBE-PATHNAME
pathname
&KEY
(:ERROR
T
))
or NIL
if it does not exist.
E.g., if you have a file file
, a directory directory
,
a symbolic link link-file
pointing to file
and a symbolic link link-dir
pointing to directory
,
then
(EXT:PROBE-PATHNAME
#P"filename") ⇒#P"/.../filename"
⇒#P"/.../filename"
⇒3427467015
⇒3171976
(EXT:PROBE-PATHNAME
#P"filename/") ⇒#P"/.../filename"
⇒#P"/.../filename"
⇒3427467015
⇒3171976
(EXT:PROBE-PATHNAME
#P"directory") ⇒#P"/.../directory/"
⇒#P"/.../directory/"
⇒3426940352
⇒1024
(EXT:PROBE-PATHNAME
#P"directory/") ⇒#P"/.../directory/"
⇒#P"/.../directory/"
⇒3426940352
⇒1024
(EXT:PROBE-PATHNAME
#P"link-file") ⇒#P"/.../filename"
⇒#P"/.../link-file"
⇒3427467015
⇒3171976
(EXT:PROBE-PATHNAME
#P"link-file/") ⇒#P"/.../filename"
⇒#P"/.../link-file"
⇒3427467015
⇒3171976
(EXT:PROBE-PATHNAME
#P"link-dir") ⇒#P"/.../directory/"
⇒#P"/.../link-dir/"
⇒3426940352
⇒1024
(EXT:PROBE-PATHNAME
#P"link-dir/") ⇒#P"/.../directory/"
⇒#P"/.../link-dir/"
⇒3426940352
⇒1024
This function may also SIGNAL
s an ERROR
if, e.g., its argument resides
under a tree for which you do not have sufficient access privileges;
unless :ERROR
is NIL
, in which case NIL
is returned instead.
These notes document CLISP version 2.49.93+ | Last modified: 2018-02-19 |