[LON-CAPA-cvs] cvs: loncom /interface printout.pl

sakharuk lon-capa-cvs@mail.lon-capa.org
Thu, 16 Oct 2003 15:30:43 -0000


sakharuk		Thu Oct 16 11:30:43 2003 EDT

  Modified files:              
    /loncom/interface	printout.pl 
  Log:
  Bug 2287 (automatic eps generation needs to preserves paths) is partly corrected - it's done for static images. Further neccessary steps are 1) implement the same for randomlabel. problems; 2) implement additional parameter to do previous item for a few students at the same time; 3) make a test for a few more situations.
  
  
Index: loncom/interface/printout.pl
diff -u loncom/interface/printout.pl:1.37 loncom/interface/printout.pl:1.38
--- loncom/interface/printout.pl:1.37	Sun Aug 31 23:30:57 2003
+++ loncom/interface/printout.pl	Thu Oct 16 11:30:43 2003
@@ -1,7 +1,7 @@
 #!/usr/bin/perl
 # CGI-script to run LaTeX, dvips, ps2ps, ps2pdf etc.
 #
-# $Id: printout.pl,v 1.37 2003/09/01 03:30:57 albertel Exp $
+# $Id: printout.pl,v 1.38 2003/10/16 15:30:43 sakharuk Exp $
 #
 # Copyright Michigan State University Board of Trustees
 #
@@ -26,6 +26,7 @@
 # http://www.lon-capa.org/
 #
 
+use File::Path;
 use IO::File;
 use Image::Magick;
  print "Content-type: text/html\n\n";
@@ -48,8 +49,11 @@
 	      my $eps_f = $not_eps;
 	      $eps_f =~ s/\.[^.]*$/\.eps/i;
 	      $_ = $eps_f;
-	      m/\/([^\/]+)$/;
+	      m/\/home\/httpd\/html\/res\/(.+)/;
 	      $eps_f = '/home/httpd/prtspool/'.$1;
+	      my $path=$eps_f;
+	      $path=~s/\/([^\/]+)\.eps$//; 
+	      File::Path::mkpath($path,0,0777);
 	      my $image = Image::Magick->new;
 	      $not_eps =~ s/^\s+//;
 	      $not_eps =~ s/\s+$//;
@@ -69,7 +73,6 @@
 	      }  
 	  }
       }
-      unlink $figfile;
   }
   #print "$texfile\n"; #name of the tex file for debugging only
   if (-e $texfile) {