From 5986c5c6ad02ecd052cbb4c8e581cb4bccd2e624 Mon Sep 17 00:00:00 2001 From: Tassilo Horn Date: Thu, 13 Mar 2008 18:12:28 +0000 Subject: [PATCH] (doc-view-doc->txt, doc-view-convert-current-doc): Create cache dir only if it doesn't already exist. --- lisp/ChangeLog | 5 +++++ lisp/doc-view.el | 8 +++++--- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/lisp/ChangeLog b/lisp/ChangeLog index 7d3a16bde9b..93edc4addcd 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog @@ -1,3 +1,8 @@ +2008-03-13 Tassilo Horn + + * doc-view.el (doc-view-doc->txt, doc-view-convert-current-doc): + Create cache dir only if it doesn't already exist. + 2008-03-13 Stefan Monnier * progmodes/sh-script.el (sh-font-lock-quoted-subshell): Fix handling diff --git a/lisp/doc-view.el b/lisp/doc-view.el index 0ffc0471024..8c5fad4c3f0 100644 --- a/lisp/doc-view.el +++ b/lisp/doc-view.el @@ -600,7 +600,8 @@ Should be invoked when the cached images aren't up-to-date." (defun doc-view-doc->txt (txt callback) "Convert the current document to text and call CALLBACK when done." - (make-directory (doc-view-current-cache-dir)) + (unless (file-exists-p (doc-view-current-cache-dir)) + (make-directory (doc-view-current-cache-dir))) (case doc-view-doc-type (pdf ;; Doc is a PDF, so convert it to TXT @@ -649,7 +650,8 @@ Those files are saved in the directory given by the function (setq doc-view-pending-cache-flush t) (let ((png-file (expand-file-name "page-%d.png" (doc-view-current-cache-dir)))) - (make-directory (doc-view-current-cache-dir)) + (unless (file-exists-p (doc-view-current-cache-dir)) + (make-directory (doc-view-current-cache-dir))) (case doc-view-doc-type (dvi ;; DVI files have to be converted to PDF before Ghostscript can process @@ -1036,7 +1038,7 @@ toggle between displaying the document or editing it as text. name-types content-types)) name-types content-types (error "Cannot determine the document type"))))) - + (doc-view-make-safe-dir doc-view-cache-directory) ;; Handle compressed files, remote files, files inside archives (set (make-local-variable 'doc-view-buffer-file-name) -- 2.39.2