Re: How to change directory/path in SBCL?
- From: Pascal Bourguignon <pjb@xxxxxxxxxxxxxxxxx>
- Date: Thu, 29 Mar 2007 09:46:45 +0200
Harald Hanche-Olsen <hanche@xxxxxxxxxxxx> writes:
+ "keyboard" <xiewensheng@xxxxxxxxx>:
| When I load a lisp file using the true/full path name, many files
| which have relative path to that file cannot be loaded
The usual way to deal with this is to construct the full pathname of
the files you wish to load by using
(merge-pathnames relative-path *load-truename*)
as the pathname to load.
And CL usually maintains a different "current working directory" than
the underlying posix system (which may not even exist, for a given CL
implementation).
That is: *DEFAULT-PATHNAME-DEFAULTS*
So, the CL way of doing chdir(path);
is (setf *DEFAULT-PATHNAME-DEFAULTS* path)
A MERGE-PATHNAMES with this default path is done automatically by most
of the CL functions dealing with files.
Of course, if your implementation works on posix and provides a way to
use chdir(2), you might want to keep both synchronized.
(defun cd (path)
(setf *default-pathname-defaults* path)
#+(and clisp linux) (linux:|chdir| (namestring (truename path)))
#|and other implementation dependent insanities...|#)
--
__Pascal Bourguignon__
http://www.informatimago.com
http://pjb.ogamita.org
.
- References:
- How to change directory/path in SBCL?
- From: keyboard
- Re: How to change directory/path in SBCL?
- From: Harald Hanche-Olsen
- How to change directory/path in SBCL?
- Prev by Date: Re: How to make piping with Common LISP...!!
- Next by Date: Re: Theory Y Algebra screenshots, or, What can you do with Lisp in one year?
- Previous by thread: Re: How to change directory/path in SBCL?
- Next by thread: Windows gui application in lisp
- Index(es):
Relevant Pages
|
|