Function: ghostel--resource-root

ghostel--resource-root is a natively compiled function defined in ghostel-module-install.el.

Signature

(ghostel--resource-root)

Documentation

Return the root directory holding shipped resources (etc/, vendor/).

Prefers whichever layout is actually on disk:
- dev / package-vc-install: ghostel.el lives under lisp/, so the
  resource root is the parent of the Lisp directory.
- MELPA-style flat install: :files flattens sources into the
  package root, so the resource root equals the Lisp directory.
Falls back to the Lisp directory itself when neither layout is detectable (e.g. a standalone ghostel.el on load-path without the shipped resources), so callers always get a sensible default-directory to work in.

Source Code

;; Defined in /nix/store/1252krff0gb2kisjcpp45m50cpdskfrl-emacs-packages-deps/share/emacs/site-lisp/ghostel-module-install.el
(defun ghostel--resource-root ()
  "Return the root directory holding shipped resources (etc/, vendor/).
Prefers whichever layout is actually on disk:
- dev / `package-vc-install': ghostel.el lives under `lisp/', so the
  resource root is the parent of the Lisp directory.
- MELPA-style flat install: `:files' flattens sources into the
  package root, so the resource root equals the Lisp directory.
Falls back to the Lisp directory itself when neither layout is
detectable (e.g. a standalone ghostel.el on `load-path' without the
shipped resources), so callers always get a sensible
`default-directory' to work in."
  (when-let* ((lisp-dir (ghostel--package-directory)))
    (or (and (file-directory-p (expand-file-name "etc" lisp-dir)) lisp-dir)
        (let ((parent (file-name-as-directory
                       (expand-file-name ".." lisp-dir))))
          (and (file-directory-p (expand-file-name "etc" parent)) parent))
        lisp-dir)))