"Kostruba" == Kostruba ····@ucsb.edu (Kostruba) writes:
Kostruba> Is there a way to get the current directory name from withing a Lisp program?
Kostruba> ::::::::::::::::::::::::::::::::::::::::::::::
Kostruba> ····@cs.ucsb.edu
Kostruba> ::::::::::::::::::::::::::::::::::::::::::::::
How about using truename, and feature select on the operating
system, to get the string needed for the current directory...
This function works in Allegro 3.1 and in AKCL 609, on my NeXT and
on a Sun. Also in CMU CL 15e on the Sun. I don't have access to any
other os'es to check it out on. It might be all you need. You have to be
careful with the "./", at least with AKCL, since just passing in "."
turns the result into a pathname that is not the same as Allegro or CMU
CL. (AKCL does not return the trailing slash...) I don't know who is
right. PS, I don't know lisp, so please tell me what I am missing here.
(defun my-cwd ()
(truename #+unix "./" #+vms "[]"))
--
Karl F. Sierka L a b y r i n t h
=====================================================================
Senior Software Consultant Computer Services
···········@Labyrinth.COM PO Box 4626
(303)441-8288 Boulder, CO 80306
In article <·························@amaze.Labyrinth.com> ···········@Labyrinth.com (Karl Sierka) writes:
>Kostruba> Is there a way to get the current directory name from withing a Lisp program?
> How about using truename, and feature select on the operating
> system, to get the string needed for the current directory...
> (truename #+unix "./" #+vms "[]"))
In Common Lisp, pathnames are merged with the pathname in
*DEFAULT-PATHNAME-DEFAULTS*. So the above will return the truename of that
default, not the Unix working directory.
--
Barry Margolin
System Manager, Thinking Machines Corp.
······@think.com {uunet,harvard}!think!barmar