Function: dnd-get-local-file-uri
dnd-get-local-file-uri is a byte-compiled function defined in
dnd.el.gz.
Signature
(dnd-get-local-file-uri URI)
Documentation
Return an uri converted to file:/// syntax if uri is a local file.
Return nil if URI is not a local file.
Source Code
;; Defined in /usr/src/emacs/lisp/dnd.el.gz
(defun dnd-get-local-file-uri (uri)
"Return an uri converted to file:/// syntax if uri is a local file.
Return nil if URI is not a local file."
;; The hostname may be our hostname, in that case, convert to a local
;; file. Otherwise return nil. TODO: How about an IP-address as hostname?
(let ((sysname (system-name)))
(let ((hostname (when (string-match "^file://\\([^/]*\\)" uri)
(downcase (match-string 1 uri))))
(sysname-no-dot
(downcase (if (string-match "^[^\\.]+" sysname)
(match-string 0 sysname)
sysname))))
(when (and hostname
(not (eq system-type 'windows-nt))
(or (string-equal "localhost" hostname)
(string-equal (downcase sysname) hostname)
(string-equal sysname-no-dot hostname)))
(concat "file://" (substring uri (+ 7 (length hostname))))))))