[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#347992: tetex-base: mptopdf fails when src file is not in current dir



Sanjoy Mahajan wrote:

Package: tetex-base
Version: 3.0-11
Severity: normal
File: /usr/share/texmf-tetex/scripts/context/perl/mptopdf.pl

If you run mptopdf on a metapost eps file in a subdirectory, then
mptopdf reports that it converted it.  However, it actualy leaves the
output in ./mpbasename.pdf.  For example:

$ mptopdf xyz/fig.11
This is pdfeTeX, Version 3.141592-1.21a-2.2 (Web2C 7.5.4)
...
Output written on fig.pdf (1 page, 13923 bytes).
MPtoPDF 1.3 : xyz/fig.11 is converted to xyz/fig-11.pdf
$ ls -l xyz/fig-11.pdf
ls: xyz/fig-11.pdf: No such file or directory
$ ls -l fig.pdf  # here it is
-rw-r--r--  1 sanjoy sanjoy 13923 2006-01-13 16:27 fig.pdf

Here is a patch:

--- mptopdf.pl.bak	2004-08-31 06:06:09.000000000 -0400
+++ mptopdf.pl	2006-01-13 16:37:15.000000000 -0500
@@ -22,6 +22,7 @@
use Config ;
use Getopt::Long ;
use strict ;
+use File::Basename;

$Getopt::Long::passthrough = 1 ; # no error message
$Getopt::Long::autoabbrev  = 1 ; # partial switch accepted
@@ -106,8 +107,9 @@
          { system ("$command   \\relax $file") }
        else
          { system ("$command \\\\relax $file") }
-        rename ("$_.pdf", "$_-$1.pdf") ;
-        if (-e "$_.pdf") { CopyFile ("$_.pdf", "$_-$1.pdf") }
+        my $pdfsrc = basename($_).".pdf";
+        rename ($pdfsrc, "$_-$1.pdf") ;
+        if (-e $pdfsrc) { CopyFile ($pdfsrc, "$_-$1.pdf") }
        if ($done) { $report .= " +" }
        $report .= " $_-$1.pdf" ;
        ++$done } }


ok, i patched it as you submitted (no time to test now) ; I assume that File::Basename is always present.

Thanks

Hans



Reply to: