SVN: toys/rsget.pl/rsget.pl
sparky
sparky at pld-linux.org
Thu Jun 11 13:24:05 CEST 2009
Author: sparky
Date: Thu Jun 11 13:24:05 2009
New Revision: 10392
Modified:
toys/rsget.pl/rsget.pl
Log:
- if file already exists, rename the old one (very likely to be truncated)
instead of the downloaded one
Modified: toys/rsget.pl/rsget.pl
==============================================================================
--- toys/rsget.pl/rsget.pl (original)
+++ toys/rsget.pl/rsget.pl Thu Jun 11 13:24:05 2009
@@ -140,14 +140,15 @@
{
my $fn = $self->{file_name};
if ( -r $fn ) {
+ my $fn_old = $fn;
my $ext = "";
- $ext = $1 if $fn =~ s/(\..{3,5})$//;
+ $ext = $1 if $fn_old =~ s/(\..{3,5})$//;
my $i = 1;
- while ( -r "$fn-$i$ext" ) {
+ while ( -r "$fn_old-$i$ext" ) {
$i++;
}
- $fn .= "-$i$ext";
- $self->{file_name} = $fn;
+ $fn_old .= "-$i$ext";
+ rename $fn, $fn_old;
}
my $net = $self->{obj}->{net};
$self->{obj}->{netname} =~ s/] .*/] $fn: /;
More information about the pld-cvs-commit
mailing list