[Openmcl-devel] Re: logical pathname conundrum

james anderson james.anderson at setf.de
Thu Feb 19 19:34:32 PST 2004


On Thursday, Feb 19, 2004, at 23:59 Europe/Berlin, Gary King wrote:

> Here is some code to make a pathname:
>
> #+DIGITOOL
> (setf (logical-pathname-translations "foo")
>       '(("foo:**;*.*" #P"Users:gwking:**:*.*")))
>
> #-DIGITOOL
> (setf (logical-pathname-translations "foo")
>       '(("foo:**;*.*" "/Users/gwking/**/*.*")))

you probably don't want to do this. use pathname constructors. if you  
do somthing like

(setf (logical-pathname-translations "foo")
	`(("foo:**;*.*" (make-pathname :directory '(:absolute "Users" "gwking"  
:wild-inferiors)
                                     :name :wild :type :wild))))

you will save yourself - and anyone who should ever need to port your  
code - a lot of grief in the long run.

>
> (make-pathname :name "a"
>                :type "b"
>                :directory '(:relative "c")
>                :defaults "foo:tinaa;")

mcl is off the mark. the merging in make-pathname is not the same as in  
merge-pathnames. the value specified with :directory '(:relative "c")  
is a value. as would be the value nil. the defaults apply when no value  
is supplied only. the merging is "... used to fill in any  
<em>unsupplied</em> components ...."

http://www.google.com/groups?hl=en&lr=&ie=UTF- 
8&threadm=8gml19%24m46%241%40nnrp1.deja.com&rnum=1&prev=/ 
groups%3Fq%3Dmake- 
pathname%2Bdefaults%2Bgroup:comp.lang.lisp.*%26hl%3Den%26lr%3D%26ie%3DUT 
F- 
8%26group%3Dcomp.lang.lisp.*%26selm%3D8gml19%2524m46%25241%2540nnrp1.dej 
a.com%26rnum%3D1

note that the rule for the default host means that the more portable  
form will need to be something like

(merge-pathnames (make-pathname :name "a" :type "b" :directory  
'(:relative "c")
                                 :defaults (make-pathname :host "foo"))
                  (make-pathname :directory '(:absolute "tinaa")))

or

(merge-pathnames (make-pathname :name "a" :type "b" :directory  
'(:relative "c") :host nil)
                  (make-pathname :directory '(:absolute "tinaa") :host  
"foo"))

but you'd have to verify those. (whereby, all the components are  
explicit here, but i suspect you are intending to supply variables for  
some of them.)

...




More information about the Openmcl-devel mailing list