|
View:
New views
6 Messages
—
Rating Filter:
Alert me
|
|
|
logical pathnames issuesI'm having some issues with logical pathnames. I'm fairly new to
common lisp so go easy on me ;) I've done: (setf common:*parse-namestrings-ansi* t) (setf (logical-pathname-translations "home") '((#P"home:**;*.*" #P"/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. Is this a bug, or am I missing something? Also I'm not sure I understand the correlation between the mappings in logical-pathname-translations. Regards, MG ------------------------------------------------------------------------------ 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 |
|
|
Re: logical pathnames issuesMichael 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 |
|
|
Re: logical pathnames issuesThank you for your answer and all the doc links!
The translate-pathname documenation was very instructive. When I first came across the logical pathname thing, I thought, "now isn't that just too neat." I'm now seeing that it is horribly non- portable, and causes a lot of head scratching. I've got two different CLs giving me two different things. So I think I will take your advice and avoid them. Thanks again for the wonderful reply! On Oct 21, 2009, at 2:26 PM, Sam Steingold wrote: > 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 |
|
|
Re: logical pathnames issuesMichael Grubb wrote:
> I'm having some issues with logical pathnames. I'm fairly new to > common lisp so go easy on me ;) > > I've done: > (setf common:*parse-namestrings-ansi* t) > > (setf (logical-pathname-translations "home") > '((#P"home:**;*.*" #P"/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. "/Users/mgrubb/Source". This is a hassle if you have many mixed case directories and files, but I think that's just the way it is. Ray ------------------------------------------------------------------------------ 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 |
|
|
Re: logical pathnames issuesMichael Grubb wrote:
> Thank you for your answer and all the doc links! welcome. > When I first came across the logical pathname thing, I thought, "now > isn't that just too neat." I'm now seeing that it is horribly non- > portable, and causes a lot of head scratching. actually, the intent of logical pathnames is clear and, IMO, it quite succeeds. the idea is to create an abstract layer that would map to _any_ platform. the lcd is case converting case insensitive, so this is what logical pathnames are. the advantage is that they easily project to any existing platform. > I've got two different CLs giving me two different things. although a lot of pathnames details are left to implementations, this is not good. what is the discrepancy? > So I think > I will take your advice and avoid them. this is certainly up to you. ------------------------------------------------------------------------------ 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 |
|
|
Re: logical pathnames issuesOn Oct 22, 2009, at 8:32 AM, Sam Steingold wrote: >> I've got two different CLs giving me two different things. > > although a lot of pathnames details are left to implementations, > this is not good. what is the discrepancy? CLISP & SBCL will both translate "home:Library;Lisp;Systems;" to "/ Users/mgrubb/library/lisp/systems/" However OpenMCL/ClozureCL translates to "/Users/mgrubb/Library/Lisp/ Systems/" My guess is that since OpenMCL seems to cater to Mac OS X it is preserving the case. ------------------------------------------------------------------------------ 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 |
| Free embeddable forum powered by Nabble | Forum Help |