searching for share directories, was: 5.11.0 can not load diff_form



OK, here is an attempt at some Lisp code to look for share directories.

(1) File & directory stuff varies from Lisp to Lisp.
I think the code below works for Clisp, GCL, SBCL, and Allegro (all Linux).

(2) find-share-directories returns a list of pathnames (not strings).
At present $file_search_lisp and $file_search_maxima are lists of strings,
so I guess the pathnames will have to be converted to strings.

(3) At present find-share-directories looks for directories containing
Lisp files. It should be called twice (with the file type as an argument),
once to get Lisp files and once to get Maxima files.

(4) I wouldn't be a bit surprised if this code could be greatly simplified.

Anyway hope this is heading in the right direction.

Robert


(defun find-share-directories (directory-pathname)
  (append
    (if (directory (append-pathname directory-pathname "*.lisp"))
      (list directory-pathname))
    (apply #'append (mapcar #'find-share-directories (directory
(append-pathname directory-pathname #+clisp "*/" #-clisp "*"))))))

(defun append-pathname (directory-pathname filename)
  (concatenate-pathname
    (append
      (pathname-directory directory-pathname)
      (list (pathname-name directory-pathname))
      (list filename))))

(defun concatenate-pathname (L)
  (if #+gcl (equal (car L) :root) #-gcl (equal (car L) :absolute)
    (concatenate 'string "/" (concatenate-pathname (cdr L)))
    (apply #'concatenate
           (append
             (list 'string)
             (list (car L))
             (apply #'append (mapcar #'(lambda (s) (list "/" s)) (cdr L)))))))