From: The Glauber
Subject: How to change current directory?
Date: 
Message-ID: <8k4gui$i67$1@nnrp1.deja.com>
Hello, here's another newbie question: how do you change the current
directory in CL? I couldn't find a "cd" or "chdir" (or even change-
current-directory :-)) command. Is this one of the platform-specific
things? I currently have Clisp and Corman Lisp installed.

Thanks!

--
Glauber Ribeiro
··········@my-deja.com
"Opinions stated are my own and not representative of Experian"


Sent via Deja.com http://www.deja.com/
Before you buy.

From: Kent M Pitman
Subject: Re: How to change current directory?
Date: 
Message-ID: <sfwr995y5zc.fsf@world.std.com>
The Glauber <··········@my-deja.com> writes:

> Hello, here's another newbie question: how do you change the current
> directory in CL? I couldn't find a "cd" or "chdir" (or even change-
> current-directory :-)) command. Is this one of the platform-specific
> things? I currently have Clisp and Corman Lisp installed.

What *is* the "current directory"?  That's an OS-defined term and you're
asking about a language that tries to transcend OS-level dependencies.

Common Lisp contains no functions which would be able to detect 
the "current directory".  The default for pathnames is controlled by
the variable *default-pathname-defaults*, whether or not there is a
current directory in the "shell" sense.

Part of the reason for this is that CL wanted to leave room for the
possibility that the implementation is multi-tasking.  A "cd"
operation would have no way of "binding" the directory; there would
have to be a with-current-directory special form which knew how to
bind things so that one task's doing "cd" didn't injure another task's
correct execution. And to what end?  The only thing "cd" ends up
affecting is the use of not-fully-qualified pathnames, and
*default-pathname-defaults* already deals with that.  (And, by
contrast, the virtue of using *default-pathname-defaults* to control
the defaults for not-fully-qualified-pathnames is that it's already
got a mechanism for binding it per-process: LET.)  If you're going to
exec something using some implementation-defined shell-exec kind of
command, just make sure you put the cd command into the stuff you exec
so it doesn't affect other multi-tasked processes you didn't mean to
affect.

Hope that helps.
From: Rudolf Schlatte
Subject: Re: How to change current directory?
Date: 
Message-ID: <lxituioyzi.fsf@ist.tu-graz.ac.at>
The Glauber <··········@my-deja.com> writes:

> Hello, here's another newbie question: how do you change the current
> directory in CL? I couldn't find a "cd" or "chdir" (or even change-
> current-directory :-)) command. Is this one of the platform-specific
> things? I currently have Clisp and Corman Lisp installed.

Two answers:  

Look at *default-pathname-defaults* and merge-pathnames in the Hyperspec.

http://www.xanalys.com/software_tools/reference/HyperSpec/Body/var_stdefault_e-defaultsst.html

Or have a look at CLOCC (http://clocc.sourceforge.net/), specifically
the port system.  This provides a "chdir" wrapper around the
implementation-specific change-directories, amongst others for the two
systems you use.

http://cvs.sourceforge.net/cgi-bin/cvsweb.cgi/~checkout~/clocc/src/port/sys.lisp?cvsroot=clocc

Rudi