Function: org-persist-write:file

org-persist-write:file is a byte-compiled function defined in org-persist.el.gz.

Signature

(org-persist-write:file C COLLECTION)

Documentation

Write file container C according to COLLECTION.

Source Code

;; Defined in /usr/src/emacs/lisp/org/org-persist.el.gz
(defun org-persist-write:file (c collection)
  "Write file container C according to COLLECTION."
  (org-persist-collection-let collection
    (when (or (and path (file-exists-p path))
              (and (stringp (cadr c)) (file-exists-p (cadr c))))
      (when (and (stringp (cadr c)) (file-exists-p (cadr c)))
        (setq path (cadr c)))
      (let* ((persist-file (plist-get collection :persist-file))
             (ext (file-name-extension path))
             (file-copy (org-file-name-concat
                         org-persist-directory
                         (format "%s-%s.%s" persist-file (md5 path) ext))))
        (unless (file-exists-p file-copy)
          (unless (file-exists-p (file-name-directory file-copy))
            (make-directory (file-name-directory file-copy) t))
          (copy-file path file-copy 'overwrite))
        (format "%s-%s.%s" persist-file (md5 path) ext)))))