瀏覽代碼

org.el: Make sure a file exists before trying to delete it.

* org.el (org-create-formula-image-with-dvipng)
(org-create-formula-image-with-imagemagick): Make sure a file
exists before trying to delete it.

Thanks to Benjamin Motz for this idea.
Bastien Guerry 13 年之前
父節點
當前提交
6b482c4ed5
共有 1 個文件被更改,包括 4 次插入2 次删除
  1. 4 2
      lisp/org.el

+ 4 - 2
lisp/org.el

@@ -17248,7 +17248,8 @@ inspection."
 	;; Use the requested file name and clean up
 	(copy-file pngfile tofile 'replace)
 	(loop for e in '(".dvi" ".tex" ".aux" ".log" ".png" ".out") do
-	      (delete-file (concat texfilebase e)))
+	      (if (file-exists-p (concat texfilebase e))
+		  (delete-file (concat texfilebase e))))
 	pngfile))))
 
 (defvar org-latex-to-pdf-process) ;; Defined in org-latex.el
@@ -17353,7 +17354,8 @@ inspection."
 	;; Use the requested file name and clean up
 	(copy-file pngfile tofile 'replace)
 	(loop for e in '(".pdf" ".tex" ".aux" ".log" ".png") do
-	      (delete-file (concat texfilebase e)))
+	      (if (file-exists-p (concat texfilebase e))
+		  (delete-file (concat texfilebase e))))
 	pngfile))))
 
 (defun org-splice-latex-header (tpl def-pkg pkg snippets-p &optional extra)