[Ecls-list] default pathname question

Marco Antoniotti marcoxa at cs.nyu.edu
Wed Jul 14 10:26:21 UTC 2004


On Jul 14, 2004, at 11:02 AM, Michael O'Connor wrote:

> Hi,
>
> I'm trying to set up a default directory in my C
> application that load will use when looking for files
> at runtime. In Lisp I've found the following works:
>
> (setf *default-pathname-defaults* (make-pathname
> :directory "path/to/files"))

You should read the manual for MAKE-PATHNAME

It looks like you really want

(setf *default-pathname-defaults* (make-pathname :directory (list 
:relative "path" "to" "files")))



> ...
> (load "test.lsp")
> (load "../test.lsp")
> etc.
>
> In my app, I've got:
>
> char *lisp_path = "/path/to/files";
> cl_defparameter(cl_intern(1,
> make_simple_string("*DEFAULT-PATHNAME-DEFAULTS*")),
>     cl_list(1, cl_pathname_directory(
>         make_string_copy(&lisp_path[1]))));
>
> But when I run this I get error "((:RELATIVE "path"
> "to" "files")) cannot be coerced to a pathname.

I presume that 'cl_pathname_directory' does the right thing and returns 
a list, which you are listifying again.  Hence the error, probably 
downstream.

Try to do

	(pathname-directory (parse-namestring "path/to/files")) ;  There is a 
trick question here :)

to the REPL and see what you get.

Cheers

--
Marco Antoniotti					http://bioinformatics.nyu.edu
NYU Courant Bioinformatics Group		tel. +1 - 212 - 998 3488
715 Broadway 10th FL				fax. +1 - 212 - 998 3484
New York, NY, 10003, U.S.A.





More information about the ecl-devel mailing list