Function: bazel--extract-archive

bazel--extract-archive is a natively compiled function defined in bazel.el.

Signature

(bazel--extract-archive FILE DIRECTORY)

Documentation

Extract the archive FILE into DIRECTORY.

Source Code

;; Defined in /nix/store/ws8pkszjvcad1rgzqw6wja7qxacylfhn-emacs-packages-deps/share/emacs/site-lisp/elpa/bazel-20261002.1510/bazel.el
(defun bazel--extract-archive (file directory)
  "Extract the archive FILE into DIRECTORY."
  (declare (ftype (function (string string) null)))
  (cl-check-type file string)
  (cl-check-type directory string)
  (when (or (file-remote-p file) (file-remote-p directory))
    (user-error "Can't extract remote file %s" file))
  ;; Prefer BSD tar if installed, as it supports more archive types.
  (let ((program (cl-some #'executable-find '("bsdtar" "tar"))))
    (unless program
      (user-error "Don’t know how to extract %s" file))
    (with-temp-buffer
      (let ((status (call-process program nil t nil
                                  "-x"
                                  "-f" (file-name-unquote file)
                                  "-C" (file-name-unquote directory))))
        (unless (eql status 0)
          (error "Program %s failed with status %s, output %s"
                 program status (buffer-string))))))
  nil)