Function: url-file-find-possibly-compressed-file

url-file-find-possibly-compressed-file is a byte-compiled function defined in url-file.el.gz.

Signature

(url-file-find-possibly-compressed-file FNAME &rest _)

Documentation

Find the exact file referenced by fname.

This tries the common compression extensions, because things like ange-ftp is not quite smart enough to realize when a server can do automatic decompression for them, and won't find foo if foo.gz exists, even though the FTP server would happily serve it up to them.

Source Code

;; Defined in /usr/src/emacs/lisp/url/url-file.el.gz
(defun url-file-find-possibly-compressed-file (fname &rest _)
  "Find the exact file referenced by `fname'.
This tries the common compression extensions, because things like
ange-ftp is not quite smart enough to realize when a server can
do automatic decompression for them, and won't find `foo' if
`foo.gz' exists, even though the FTP server would happily serve
it up to them."
  (let ((scratch nil)
	(compressed-extensions '("" ".gz" ".z" ".Z" ".bz2" ".xz"))
	(found nil))
    (while (and compressed-extensions (not found))
      (if (file-exists-p (setq scratch (concat fname (pop compressed-extensions))))
	  (setq found scratch)))
    found))