summary refs log tree commit diff
diff options
context:
space:
mode:
authorLudovic Courtès2007-12-14 12:57:21 +0100
committerLudovic Courtès2007-12-14 12:57:21 +0100
commitdd6352451a8d831724fb919d66fd9900241769e1 (patch)
treeb8994c9502718e4a769e6757876b585763ee7afa
parent28d2d0f31f51e2b667f5a7fa3bd3347edf2d8e22 (diff)
downloadskribilo-dd6352451a8d831724fb919d66fd9900241769e1.tar.gz
skribilo-dd6352451a8d831724fb919d66fd9900241769e1.tar.lz
skribilo-dd6352451a8d831724fb919d66fd9900241769e1.zip
Fix `convert-image' so that it does not copy several times.
* src/guile/skribilo/utils/images.scm (builtin-convert-image): Add `~%'.
  (convert-image): Check `(file-exists? dest-path)' before invoking
  `copy-file'.  This makes `distcheck' happy: a second `copy-file' would
  fail if the file was already copied and is marked read-only.
-rw-r--r--src/guile/skribilo/utils/images.scm11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/guile/skribilo/utils/images.scm b/src/guile/skribilo/utils/images.scm
index 6dcbda0..29535a3 100644
--- a/src/guile/skribilo/utils/images.scm
+++ b/src/guile/skribilo/utils/images.scm
@@ -1,7 +1,7 @@
 ;;; images.scm  --  Images handling utilities.
 ;;;
+;;; Copyright 2005, 2006, 2007  Ludovic Courtès <ludo@gnu.org>
 ;;; Copyright 2003, 2004  Erick Gallesio - I3S-CNRS/ESSI <eg@unice.fr>
-;;; Copyright 2005, 2006  Ludovic Courtès <ludovic.courtes@laas.fr>
 ;;;
 ;;;
 ;;; This program is free software; you can redistribute it and/or modify
@@ -59,9 +59,9 @@
 				   from " " to))))
 	 (cond
 	   ((> (*verbose*) 1)
-	    (format (current-error-port) "  [converting image: ~S (~S)]" from c))
+	    (format (current-error-port) "  [converting image: ~S (~S)]~%" from c))
 	   ((> (*verbose*) 0)
-	    (format (current-error-port) "  [converting image: ~S]" from)))
+	    (format (current-error-port) "  [converting image: ~S]~%" from)))
 	 (and (zero? (system c))
 	      to))))))
 
@@ -78,8 +78,9 @@
 		(if dir
 		    (let* ((dest (basename path))
 			   (dest-path (string-append dir "/" dest)))
-		      (if (not (string=? path dest-path))
-			  (copy-file path dest-path))
+		      (if (and (not (string=? path dest-path))
+                               (not (file-exists? dest-path)))
+                          (copy-file path dest-path))
 		      dest)
 		    path))
 	      (let loop ((fmts formats))