Function: nnheader-find-etc-directory

nnheader-find-etc-directory is a byte-compiled function defined in nnheader.el.gz.

Signature

(nnheader-find-etc-directory PACKAGE &optional FILE FIRST)

Documentation

Go through load-path and find the "../etc/PACKAGE" directory.

This function will look in the parent directory of each load-path entry, and look for the "etc" directory there. If FILE, find the ".../etc/PACKAGE" file instead. If FIRST is non-nil, return the directory or the file found at the first. Otherwise, find the newest one, though it may take a time.

Source Code

;; Defined in /usr/src/emacs/lisp/gnus/nnheader.el.gz
(defun nnheader-find-etc-directory (package &optional file first)
  "Go through `load-path' and find the \"../etc/PACKAGE\" directory.
This function will look in the parent directory of each `load-path'
entry, and look for the \"etc\" directory there.
If FILE, find the \".../etc/PACKAGE\" file instead.
If FIRST is non-nil, return the directory or the file found at the
first.  Otherwise, find the newest one, though it may take a time."
  (let ((path load-path)
	dir results)
    ;; We try to find the dir by looking at the load path,
    ;; stripping away the last component and adding "etc/".
    (while path
      (if (and (car path)
	       (file-exists-p
		(setq dir (concat
			   (file-name-directory
			    (directory-file-name (car path)))
			   "etc/" package
			   (if file "" "/"))))
	       (or file (file-directory-p dir)))
	  (progn
	    (or (member dir results)
		(push dir results))
	    (setq path (if first nil (cdr path))))
	(setq path (cdr path))))
    (if (or first (not (cdr results)))
	(car results)
      (car (sort results #'file-newer-than-file-p)))))