[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

HELP: Pathname Translations

Okay, I admit it, I can't make heads nor tails out of Lisp's file
system interface. I'm hoping someone can help me out with my current
problem, and point to a better explanation than Chapter 23 in [CLtL2].

Here's my immediate problem: I'm writing some code which needs to
refer to MPW libraries in order to define some foreign function
interfaces. Rather than embed absolute pathnames in the code, I'd
like to setup translations based on the following assumptions:

	1. The libraries I want are stored in a subfolder of the
	   standard MPW 3.3 distribution. The libraries may be in
	   either the C library folder or the general library folder.

	   From the MPW folder, the paths to the relevant folders are:


	   I know which folder a given file will be stored in.

	2. The MPW folder will be stored at the "root" level of one of
	   the hard disks connected to the Mac.

So, to combine Unix wildcards with Mac directories, I want something
like this:


The best thing I've been able to come up with so far is:

(setf (logical-pathname-translations "mpw")
         ,(car (directory "*:MPW:Libraries:CLibraries:" :directories t)))
         ,(car (directory "*:MPW:Libraries:Libraries:" :directories t)))
        ("**;*.*" ,(car (directory "*:MPW:" :directories t)))))

These translations are then used to define a list of libraries which
will be passed to ff-load:

(defvar *mpw-libraries*

It seems to me that there ought to be a way to do this that doesn't
involve a call to directory. Is there? How would things change if I
didn't know where the MPW folder was? What if I didn't know which
folder a given library would be stored in?

Can anyone point me to a good tutorial on the Lisp file system
interface? Steele is about as clear as mud, and all of the tutorial
books I've seen are too busy worrying about cons, car, and cdr to talk
about pathnames...

Many thanks!

							-- Scott

"You know, it's 1984 all over again..."
				      - Guy Kawasaki, when asked about Newton