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

Carry tape



    Date: Sat, 11 Feb 89 14:53 EST
    From: barmar@Think.COM (Barry Margolin)

    Has anyone modified Read Carry Tape so that it doesn't ask so many
    questions?  We'd like to be able to write a carry tape containing a
    hierarchy with lots of subdirectories, and then when we read it at the
    destination we would like to be able to specify the new directory that
    corresponds to the original top-level directory, rather than getting
    queried (three times -- once to answer "O", a second time to allow the
    directory to be created, and again to answer "A" for the remaining files
    in the directory) for each directory.

    For example, currently a tape containing a directory and its
    subdirectory results in the following:
				:
				:
    I'd like to be able to answer one question about the translation of the
    directory name, perhaps a single question about creating the new
    top-level directory, and then not be bothered until it encounters a file
    that wasn't in that hierarchy.

    If anyone can think of an existing mechanism in Genera that allows this
    kind of pathname translation, but uses a different tape format, that
    would be good, too.  We're trying to use this for our software
    distribution tape (our software isn't organized using DEFSYSTEM,
    although in the past we've used a DEFSYSTEM-based kludge for the tapes),
    and it would be preferable if the customer didn't need to load something
    just to be able to read the tape.

						    barmar

Unfortunately, every time I've ever wanted something like this, I also needed slightly
different rules for coercing the pathname-string stored on the carry tape into a pathname
than the last time I wanted it, so I never wrote a general-purpose function.

I take the approach of calling CARRY-LOAD wrapped in an application-specific replacement
for the system's TAPE:CARRY-LOAD-TARGET-PATHNAME, each time I use it, viz.:

(letf ((#'tape:carry-load-target-pathname #'my-replacement))
  (tape:carry-load ...))

where my-replacement might be something along the lines of:

(defun my-replacement (plist)
  (let* (pathname
	 (pathname-string (si:get plist :pathname)) ;misnomer, this isn't a pathname
	 (pathname-as-if-to-local-host
	   (fs:parse-pathname (string-append (send neti:*local-host* :name-as-file-computer)
					     ":" pathname-string))))
    
    (setq pathname
	  ... ; the appropriate merging of the pathname on tape and the desired default
	  )
     ))

Usually my-replacement is simple enough that I can type it into the machine as I need it,
only maybe twice out of a dozen times were the coercion requirements tricky enough that
I had to type it into an editor buffer and debug it before deploying.

Note that the replacement function should either return the pathname you want the tape
file copied to, or NIL to skip the file.  Of course, if you want to prompt the user for
the pathname,your version could call (accept 'fs:pathname) along the way.