Pathnames are used to represent files in a storage device[1]. However, before using a pathname to perform a filesystem operation, ECL will have to apply a number of transformations to it. First of all, if the pathname is a logical one it has to be converted to a physical pathname. Second, this physical pathname must not be a relative one, it has to be converted into an absolute pathname.
The convertion of a relative pathname into an absolute one is performed
automatically by many Common Lisp functions. The overall procedure consists
on merging the pathname with the value of
*default-pathname-defaults*
.
A problem with this approach is that many Lisp programs are not
prepared to have *default-pathname-defaults*
pointing to
an actual directory. Also, additional to the maintaining value of this
variable, programs have to take care of the notion of the "current working
directory" as understood by the operating system. Finally the variable
*default-pathname-defaults*
influences not only the
resolution of relative pathnames, but also many other functions
(MAKE-PATHNAME
, MERGE-PATHNAMES
,
etc), what makes its use complicated.
The approach followed by ECL is to set
*default-pathname-defaults*
to a pathname with all
elements set to NIL, (MAKE-PATHNAME :NAME NIL :TYPE NIL
...)
. Then, every physical pathname which is to be converted to an
absolute one is first merged with the value of
*default-pathname-defaults*
and afterwards with the
pathname with the output of SI:GETCWD
, which returns the
current working directory as understood by the operating system.