Function: mpc-file-local-copy
mpc-file-local-copy is a byte-compiled function defined in mpc.el.gz.
Signature
(mpc-file-local-copy FILE)
Source Code
;; Defined in /usr/src/emacs/lisp/mpc.el.gz
(defun mpc-file-local-copy (file)
;; Try to set mpc-mpd-music-directory.
(when (and (null mpc-mpd-music-directory)
(or (string-match "\\`localhost" mpc-host)
(file-name-absolute-p mpc-host)))
(let ((files `(,(let ((xdg (getenv "XDG_CONFIG_HOME")))
(concat (if (and xdg (file-name-absolute-p xdg))
xdg "~/.config")
"/mpd/mpd.conf"))
"~/.mpdconf" "~/.mpd/mpd.conf" "/etc/mpd.conf"))
file)
(while (and files (not file))
(if (file-exists-p (car files)) (setq file (car files)))
(setq files (cdr files)))
(with-temp-buffer
(ignore-errors (insert-file-contents file))
(goto-char (point-min))
(if (re-search-forward "^music_directory[ ]+\"\\([^\"]+\\)\"")
(setq mpc-mpd-music-directory
(match-string 1))))))
;; Use mpc-mpd-music-directory if applicable, or else try to use the
;; `download' command, although it's never been accepted in `mpd' :-(
(if (and mpc-mpd-music-directory
(file-exists-p (expand-file-name file mpc-mpd-music-directory)))
(expand-file-name file mpc-mpd-music-directory)
;; (let ((aux (expand-file-name (replace-regexp-in-string "[/]" "|" file)
;; (mpc-data-directory))))
;; (unless (file-exists-p aux)
;; (condition-case err
;; (with-local-quit
;; (with-current-buffer (mpc-cmd-download file)
;; (write-region (point-min) (point-max) aux)
;; (kill-buffer (current-buffer))))
;; (mpc-proc-error (message "Download error: %s" err) (setq aux nil))))
;; aux)
))