« Return to Thread: logical pathnames issues

Re: logical pathnames issues

by Sam Steingold :: Rate this Message:

Reply to Author | View in Thread

Michael Grubb wrote:
> (setf (logical-pathname-translations "home")
>    '((#P"home:**;*.*" #P"/Users/mgrubb/**/*.*")))

I think the more common (and clear) way to write this is

(setf (logical-pathname-translations "home")
       '(("**;*.*" "/Users/mgrubb/**/*.*")))

> I'm doing this on both Mac OS X 10.5 ppc and Linux.
>
> So now when I try: (translate-logical-pathname #P"home:Source;")
> I get: #P"/Users/mgrubb/source/"
>
> This is both on Linux and OSX.
>
> As HFS+ is a case preserving but not sensitive (truename (translate-
> logical-pathname #P"home:Source;")) produces
> #P"/Users/mgrubb/Source/" however, on Linux I still get the wrong  
> cased pathname.

you must remember that logical pathnames are uppercase.
(e.g., http://www.lispworks.com/documentation/HyperSpec/Body/19_ca.htm 
specifies "uppercase letters, digits, and hyphens" as word constituents).
thus,
(translate-logical-pathname "home:Source;")
is equivalent to
(translate-logical-pathname "HOME:SOURCE;")

when "source" (or "SOURCE") is converted to a physical pathname element, it is
converted from "common" (upcase) to "local" case, which in the case of unix, is
lowercase (http://www.lispworks.com/documentation/HyperSpec/Body/19_bbab.htm).

the upshot is that mixed case and logical pathnames do not play well together.

you can either use lower case pathnames (with logical pathnames) or avoid
logical pathnames, e.g.
(defvar *home* #p"/Users/mgrubb/")
(defvar *source* (merge-pathnames *home" "Source/"))

> Is this a bug, or am I missing something?

chances are, this is not a bug.
despite its obscurity, the subject of logical pathnames has been tested
relatively throughly.

> Also I'm not sure I understand the correlation between the mappings in  
> logical-pathname-translations.

you might find this instructive.
http://www.lispworks.com/documentation/HyperSpec/Body/f_tr_pn.htm

------------------------------------------------------------------------------
Come build with us! The BlackBerry(R) Developer Conference in SF, CA
is the only developer event you need to attend this year. Jumpstart your
developing skills, take BlackBerry mobile applications to market and stay
ahead of the curve. Join us from November 9 - 12, 2009. Register now!
http://p.sf.net/sfu/devconference
_______________________________________________
clisp-list mailing list
clisp-list@...
https://lists.sourceforge.net/lists/listinfo/clisp-list

 « Return to Thread: logical pathnames issues