diff lisp/find-paths.el @ 1227:5636ae1c0234

[xemacs-hg @ 2003-01-22 20:31:52 by michaels] 2003-01-19 Mike Sperber <mike@xemacs.org> * startup.el (normal-top-level): Compute `emacs-data-roots.' Call `startup-setup-paths' with data-roots argument. (emacs-data-roots): Add. * dump-paths.el: Call `startup-setup-paths' with data-roots argument. (startup-setup-paths): Use `data-roots' instead of `roots' to find packages. Call `paths-find-emacs-roots' with `root-p' argument. * make-docfile.el: Call `paths-find-emacs-roots' with `root-p' argument. * find-paths.el (paths-emacs-data-root-p): Add. (paths-find-emacs-roots): Parmeterize over `root-p.'
author michaels
date Wed, 22 Jan 2003 20:31:52 +0000
parents ceedb6eeaba8
children 4542b72c005e
line wrap: on
line diff
--- a/lisp/find-paths.el	Tue Jan 21 22:52:39 2003 +0000
+++ b/lisp/find-paths.el	Wed Jan 22 20:31:52 2003 +0000
@@ -100,7 +100,7 @@
 			     max-depth paths-no-lisp-directory-regexp))
 
 (defun paths-emacs-root-p (directory)
-  "Check if DIRECTORY is a plausible installation root for XEmacs."
+  "Check if DIRECTORY is a plausible installation root."
   (or
    ;; installed
    (paths-file-readable-directory-p (paths-construct-path (list directory
@@ -111,6 +111,23 @@
     (paths-file-readable-directory-p (paths-construct-path (list directory "lisp")))
     (paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))
 
+(defun paths-emacs-data-root-p (directory)
+  "Check if DIRECTORY is a plausible data installation root.
+A data installation root is one containing data files that may be shared
+among multiple different versions of XEmacs, the packages in particular."
+  (or
+   ;; installed
+   (paths-file-readable-directory-p (paths-construct-path (list directory
+								"lib"
+								emacs-program-name)))
+   (paths-file-readable-directory-p (paths-construct-path (list directory
+								"lib"
+								(construct-emacs-version-name))))
+   ;; in-place or windows-nt
+   (and
+    (paths-file-readable-directory-p (paths-construct-path (list directory "lisp")))
+    (paths-file-readable-directory-p (paths-construct-path (list directory "etc"))))))
+
 (defun paths-chase-symlink (file-name)
   "Chase a symlink until the bitter end."
       (let ((maybe-symlink (file-symlink-p file-name)))
@@ -282,8 +299,13 @@
       directories)))
 
 (defun paths-find-emacs-roots (invocation-directory
-			       invocation-name)
-  "Find all plausible installation roots for XEmacs."
+			       invocation-name
+			       root-p)
+  "Find all plausible installation roots for XEmacs.
+INVOCATION-DIRECTORY is the directory from which XEmacs was started.
+INVOCATION-NAME is the name of the XEmacs executable that was originally
+started.
+ROOT-P is a function that tests whether a root is plausible."
   (let* ((potential-invocation-root
 	  (paths-find-emacs-root invocation-directory invocation-name))
 	 (invocation-roots
@@ -298,7 +320,7 @@
 		(list (file-name-as-directory
 		       configure-prefix-directory)))))
 	 (installation-roots
-	  (paths-filter #'paths-emacs-root-p potential-installation-roots)))
+	  (paths-filter root-p potential-installation-roots)))
     (paths-uniq-append invocation-roots
 		       installation-roots)))