Function: package--delete-directory

package--delete-directory is a byte-compiled function defined in package.el.gz.

Signature

(package--delete-directory DIR)

Documentation

Delete PKG-DESC directory DIR recursively.

Clean-up the corresponding .eln files if Emacs is native compiled, and remove the DIR from load-path.

Source Code

;; Defined in /usr/src/emacs/lisp/emacs-lisp/package.el.gz
(defun package--delete-directory (dir)
  "Delete PKG-DESC directory DIR recursively.
Clean-up the corresponding .eln files if Emacs is native
compiled, and remove the DIR from `load-path'."
  (setq load-path (cl-remove-if (lambda (s) (file-in-directory-p s dir))
                                load-path))
  (when (featurep 'native-compile)
    (cl-loop
     for file in (directory-files-recursively dir
                                              ;; Exclude lockfiles
                                              (rx bos (or (and "." (not "#")) (not ".")) (* nonl) ".el" eos))
     do (comp-clean-up-stale-eln (comp-el-to-eln-filename file))))
  (if (file-symlink-p (directory-file-name dir))
      (delete-file (directory-file-name dir))
    (delete-directory dir t)))