[Po4a-commits] po4a po4a-translate,1.27,1.28

Martin Quinson po4a-devel@lists.alioth.debian.org
Sun, 15 Aug 2004 07:28:17 +0000


Update of /cvsroot/po4a/po4a
In directory haydn:/tmp/cvs-serv8460

Modified Files:
	po4a-translate 
Log Message:
Cleanup; do not to unlink the file after the die, but before

Index: po4a-translate
===================================================================
RCS file: /cvsroot/po4a/po4a/po4a-translate,v
retrieving revision 1.27
retrieving revision 1.28
diff -u -d -r1.27 -r1.28
--- po4a-translate	15 Aug 2004 06:33:26 -0000	1.27
+++ po4a-translate	15 Aug 2004 07:28:15 -0000	1.28
@@ -227,13 +227,13 @@
 # parser
 my $doc=Locale::Po4a::Chooser::new($format,%options);
 
+
 # Prepare the document to be used as translator, but not parser
 $doc->process('po_in_name'       => \@pos,
 	      'file_in_name'     => \@masters,
 	      'file_in_charset'  => $mastchar,
 	      'addendum_charset' => $addchar);
 
-
 my ($percent,$hit,$queries) = $doc->stats();
 my $error=0;
 
@@ -247,19 +247,14 @@
 			 $master_filename,$percent,$threshold)."\n";
     unlink($outfile) if (-e $outfile);
 } else {
-    foreach (@addfiles) {
-	unless ($error) {
-	    $error ||= !$doc->addendum($_);
+    foreach my $add (@addfiles) {
+	unless ($doc->addendum($add)) {
+	    unlink($outfile) if (-e $outfile);
 	    die sprintf(gettext("Discard the translation of %s (addendum %s does not apply)."),
-				 $master_filename,$_)."\n"
-		if $error;
+		$master_filename,$add)."\n";
 	}
     }
-    if ($error) {
-	unlink($outfile) if (-e $outfile);
-    } else {
-	$doc->write($outfile);
-    }
+    $doc->write($outfile);
 }
 
 1;