[Openmcl-devel] delete-file and directories

Gary Byers gb at clozure.com
Sun Mar 13 12:38:13 PST 2005



On Sun, 13 Mar 2005, Dan Knapp wrote:

>    While we're figuring this out, do we also want to figure out stuff
> about
> getting and changing the current working directory?  Other things I'm
> missing?
>
> -- Dan Knapp
>

(ccl:mac-default-directory)

returns the physical pathname of the current directory.  (This was/is
the name of the equivalent function in MCL.  Every time I use it on a
Power3, I wince a little ...)

(ccl:cwd PATH)

sets the current directory to the directory named by PATH, and
complains if PATH doesn't exist (or if it names something other
than a directory.)  It returns a physical pathname.

Both are exported; neither are particularly well-chosen names.  I
think that I lean towards renaming these functions to:

CURRENT-DIRECTORY
and
(SETF CURRENT-DIRECTORY)

(Is the concept of "CURRENT-DIRECTORY" clear enough ?  Or should
that be something like "CURRENT-OS-DIRECTORY" ?)

The SETF function would just return its argument, which may not be
equivalent to the value currently returned by CCL:CWD.  (You could
always call CURRENT-DIRECTORY after calling (SETF CURRENT-DIRECTORY)
if the truename is important.)

? (cwd "HOME:")
#P"/home/gb/"

(defun (setf current-directory) (path)
  (ccl:cwd path)
  path)

(defun current-directory ()
  (ccl:mac-default-directory))

I suppose that it'd also be nice to have colon commands for the REPL;
maybe :CD and :PWD, or things that're equally terse.



More information about the Openmcl-devel mailing list