Function: ffap-url-unwrap-local

ffap-url-unwrap-local is a byte-compiled function defined in ffap.el.gz.

Signature

(ffap-url-unwrap-local URL)

Documentation

Return URL as a local file name, or nil.

Source Code

;; Defined in /usr/src/emacs/lisp/ffap.el.gz
;; Broke these out of ffap-fixup-url, for use of ffap-url package.
(defun ffap-url-unwrap-local (url)
  "Return URL as a local file name, or nil."
  (let* ((obj (url-generic-parse-url url))
	 (host (url-host obj))
	 (filename (car (url-path-and-query obj))))
    (when (and (member (url-type obj) '("ftp" "file"))
	       (member host `("" "localhost" ,(system-name))))
      ;; On Windows, "file:///C:/foo" should unwrap to "C:/foo"
      (if (and (memq system-type '(ms-dos windows-nt cygwin))
	       (string-match "\\`/[a-zA-Z]:" filename))
	  (substring filename 1)
	filename))))