Re: (make-pathname :name "/root") - good/bad?
- From: "Tim Bradshaw" <tfb+google@xxxxxxxx>
- Date: 30 Mar 2006 09:16:01 -0800
Geoffrey King wrote:
In LispWorks:
(make-pathname :name "root") ; --> #p"root"
(make-pathname :name "/root") ; --> #p"/root"
In CLISP (windows):
(make-pathname :name "root") ; --> #p"root"
(make-pathname :name "/root") ; --> error
The error is:
*** - MAKE-PATHNAME: illegal :NAME argument "/root"
If it makes a difference i don't have a directory called /root.
Which is the correct behaviour?
I think CLISP is closer to correct, at least on Unix: the name
component of a pathname is generally interpreted as the name part of a
file, as distinct from any directory part and on Unix file names in
this sense can't contain slashes. But they can on other systems, so it
depends on a lot of factors. If you want to convert a namestring into
a pathname object it's generally better to use PARSE-NAMESTRING or the
PATHNAME function, and let the system decide what parts are what.
(a clearer example of why what you're trying to do is going to lead to
bad things is something like:
(make-pathname :directory (:absolute "usr" "local") :name "/foo")
)
--tim
.
- References:
- (make-pathname :name "/root") - good/bad?
- From: Geoffrey King
- (make-pathname :name "/root") - good/bad?
- Prev by Date: Re: Newbie lisp problem: string to list of strings separated by space
- Next by Date: Re: What language will be used to write the first self aware program?
- Previous by thread: Re: (make-pathname :name "/root") - good/bad?
- Next by thread: Re: (make-pathname :name "/root") - good/bad?
- Index(es):
Relevant Pages
|