* (make-pathname :name "cgi-bin/")
#P"cgi-bin/"
* (merge-pathnames "nav.py" #P"cgi-bin/")
#P"cgi-bin/nav.py" ; **it is ok**
* (merge-pathnames "nav.py" (make-pathname :name "cgi-bin/"))
#P"nav.py" ; why ?
*(defvar bp #P"/media/E/myapp/cgi-bin/")
* bp
#P"/media/E/myapp/cgi-bin/")
* (merge-pathnames "nav.py" bp)
#P"nav.py" ; why ?
* (merge-pathnames "nav.py" #P"/media/E/myapp/cgi-bin/")
#P"/media/E/myapp/cgi-bin/nav.py" ; **it is ok**
I am using sbcl-1.0.54.
Any suggestion is appreciated !
A
pathnameis a structure that represents a pathname using components, like drive, host, directory, name, etc. See here for more details.You construct a
pathnameusingmake-pathnamefunction with:directory,:nameand other keywords, and the function returns an object of typepathname:The function
merge-pathnamesas documented here, completes the missing components of the pathname specified with the ones from default-pathname:Edit: it doesn’t work for you because you are constructing a pathname with
:nameand that specifies the name of the file (without extension or:type). So when you callmerge-pathnamesit doesn’t find a missing component in its pathname, because “cgi-bin/” is specified as:name(the filename), and you already got a filename in “nav.py”.