[Po4a-commits] "po4a/lib/Locale/Po4a Po.pm,1.69,1.70"

Nicolas FRANCOIS nekral-guest at alioth.debian.org
Thu Nov 30 15:40:13 CET 2006


Update of /cvsroot/po4a/po4a/lib/Locale/Po4a
In directory alioth:/tmp/cvs-serv15276/lib/Locale/Po4a

Modified Files:
	Po.pm 
Log Message:
Add a backup argument tot specify if we want a ~ backup file.


Index: Po.pm
===================================================================
RCS file: /cvsroot/po4a/po4a/lib/Locale/Po4a/Po.pm,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -d -r1.69 -r1.70
--- Po.pm	30 Nov 2006 14:17:15 -0000	1.69
+++ Po.pm	30 Nov 2006 14:40:11 -0000	1.70
@@ -343,7 +343,7 @@
 =cut
 
 sub move_po_if_needed {
-    my ($new_po, $old_po) = (shift, shift);
+    my ($new_po, $old_po, $backup) = (shift, shift, shift);
     my $diff;
 
     if (-e $old_po) {
@@ -356,6 +356,12 @@
             my ($atime, $mtime) = (time,time);
             utime $atime, $mtime, $old_po;
         } else {
+            if ($backup) {
+                copy $old_po, $old_po."~"
+                  or die wrap_msg(dgettext("po4a","Can't copy %s to %s: %s."),
+                                  $old_po, $old_po."~", $!);
+            } else {
+            }
             move $new_po, $old_po
                 or die wrap_msg(dgettext("po4a","Can't move %s to %s: %s."),
                                 $new_po, $old_po, $!);




More information about the Po4a-commits mailing list