Diff for /loncom/build/help_graphics_converter.pl between versions 1.2 and 1.5

version 1.2, 2002/07/17 15:45:49 version 1.5, 2012/01/02 11:37:02
Line 28 Line 28
   
 use strict;  use strict;
   
   ##
   #  Sub to determine the relative modification dates of files:
   #
   # @param file1 - First file
   # @param file2 - Seond file
   #
   # @return - 0 if file 1's mtime is <= file2's 1 otherwise.
   sub newer {
       my ($file1, $file2) = @_;
   
       # IF file2 does not exist, return false to force the build:
   
       if (not (-s $file2)) {
    return 0;
       }
   
       # Check modification times if file2 exists:
   
       my $m1 = (stat($file1))[9];
       my $m2 = (stat($file2))[9];
   
       return $m2 > $m1;
   }
   
 my $dirprefix = "../html/adm/help/";  my $dirprefix = "../html/adm/help/";
   
 # Check that the png directory exists  # Check that the png directory exists
Line 35  if (not (-d $dirprefix . "png/")) Line 59  if (not (-d $dirprefix . "png/"))
 { die "Can't convert help graphics because the png directory is not ".  { die "Can't convert help graphics because the png directory is not ".
       "installed."; }        "installed."; }
   
 mkdir $dirprefix . "gif/";  mkdir $dirprefix . "gif/", 0755;
 mkdir $dirprefix . "eps/";  mkdir $dirprefix . "eps/", 0755;
   
   my $convert = `which convert`;
   if ($convert eq '')
   {
       open LOG, ">> WARNINGS";
       print LOG "**** ERROR **** ImageMagick is not installed. You must install ImageMagick to use LON-CAPA. Please see your installation instructions.\n";
       print "**** ERROR **** ImageMagick is not installed. You must install ImageMagick to use LON-CAPA. Please see your installation instructions.\n";
       exit;
   }
   
 foreach my $file (glob($dirprefix . "png/*.png"))  foreach my $file (glob($dirprefix . "png/*.png"))
 {  {
Line 46  foreach my $file (glob($dirprefix . "png Line 79  foreach my $file (glob($dirprefix . "png
           
           
     print "Converting $filename... gif";      print "Converting $filename... gif";
     system ("convert $file $gifdest\n") if (not (-s $gifdest));      system ("convert $file $gifdest\n") if (not &newer($file, $gifdest));
     print " eps";      print " eps";
     system ("convert $file $epsdest\n") if (not (-s $epsdest));      system ("convert $file $epsdest\n") if (not &newer($file, $epsdest));
     print " done.\n";      print " done.\n";
 }  }

Removed from v.1.2  
changed lines
  Added in v.1.5


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>