changeset 11014:92bb25c0da9e

When appending, delete temporary files at the end of the ghostscript pipeline.
author Ben Abbott <bpabbott@mac.com>
date Wed, 22 Sep 2010 18:06:21 -0400
parents 63f79f798a14
children b4ed4fe70c2c
files scripts/ChangeLog scripts/plot/print.m scripts/plot/private/__ghostscript__.m
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/scripts/ChangeLog
+++ b/scripts/ChangeLog
@@ -1,3 +1,8 @@
+2010-09-22  Ben Abbott <bpabbott@mac.com>
+
+	* plot/private/__ghostscript__.m, plot/print.m: When appending, delete
+	temporay files at the end of the ghostscript pipeline.
+
 2010-09-21  Ben Abbott <bpabbott@mac.com>
 
 	* plot/__fltk_print__.m, plot/private/__ghostscript__.m,
--- a/scripts/plot/print.m
+++ b/scripts/plot/print.m
@@ -251,8 +251,7 @@
   if (opts.append_to_file)
     [~, ~, ext] = fileparts (opts.ghostscript.output);
     opts.ghostscript.prepend = strcat (tmpnam (), ext);
-    movefile (opts.ghostscript.output, opts.ghostscript.prepend);
-    opts.unlink{end+1} = opts.ghostscript.prepend;
+    copyfile (opts.ghostscript.output, opts.ghostscript.prepend);
   endif
 
   unwind_protect
--- a/scripts/plot/private/__ghostscript__.m
+++ b/scripts/plot/private/__ghostscript__.m
@@ -139,6 +139,11 @@
     ##         See "How to concatenate several PS files" at the link,
     ##         http://en.wikibooks.org/wiki/PostScript_FAQ
     cmd = sprintf ("%s %s", cmd, opts.prepend);
+    if (isempty (cleanup_cmd))
+      cleanup_cmd = sprintf ("rm %s", opts.prepend);
+    else
+      cleanup_cmd = sprintf ("%s ; rm %s", cleanup_cmd, opts.prepend);
+    endif
   endif
   if (! isempty (offsetfile) && format_for_printer)
     cmd = sprintf ("%s %s", cmd, offsetfile);