]> git.donarmstrong.com Git - lilypond.git/blobdiff - scm/backend-library.scm
* lily/main.cc (parse_argv): only set output format to pdf if no
[lilypond.git] / scm / backend-library.scm
index edd00941de9bfcb23d3998d71aef51fe05ed19f4..bcbcad46b68ff88c90566d0b0eae2ae90c885e2d 100644 (file)
@@ -82,9 +82,7 @@
     (ly:message (_ "Converting to `~a'...") pdf-name)
     (ly:progress "\n")
     (ly:system cmd)
-    
-    (if (ly:get-option 'delete-intermediate-files)
-       (delete-file name))))
+    ))
 
 (use-modules (scm ps-to-png))
 (define-public (postscript->png resolution paper-size-name name)
     (ly:progress "\n")))
 
 (define-public (postprocess-output paper-book module filename formats)
-  (for-each
-   (lambda (f)
-     ((eval (string->symbol (string-append "convert-to-" f)) module)
-      paper-book filename))
-   formats))
+  (let*
+      ((completed (completize-formats formats))
+       (base (string-regexp-substitute "\\.[a-z]+$" "" filename))
+       (intermediate (remove
+                     (lambda (x)
+                       (member x formats)) 
+                     completed)))
+    (for-each
+     (lambda (f)
+       ((eval (string->symbol (string-append "convert-to-" f)) module)
+       paper-book filename))
+     completed)
+
+    (if (ly:get-option 'delete-intermediate-files)
+       (for-each
+        (lambda (f)
+          (display  (string-append base "." f))
+          (display  "del\n")
+          (delete-file (string-append base "." f)))
+        intermediate))
+    ))
 
 (define-public (completize-formats formats)
   (define new-fmts '())