Changeset 13322


Ignore:
Timestamp:
2006-11-24T11:50:32+13:00 (17 years ago)
Author:
kjdon
Message:

allowed new passing in of a directory to useWget - will cd to this dir before running the wget command

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/downloaders/WgetDownload.pm

    r13012 r13322  
    3535use strict;
    3636use IPC::Open2;
     37use Cwd;
    3738
    3839sub BEGIN {
     
    126127sub useWget
    127128{
    128     my ($self, $cmdWget,$blnShow) = @_;
     129    my ($self, $cmdWget,$blnShow, $working_dir) = @_;
    129130
    130131    my ($strReadIn,$strLine,$command);
    131132    $strReadIn = "" unless defined $strReadIn;
    132133
     134    my $current_dir = cwd();
     135    my $changed_dir = 0;
     136    if (defined $working_dir && -e $working_dir) {
     137    chdir "$working_dir";
     138    $changed_dir = 1;
     139    }
    133140    my $wget_file_path = &util::filename_cat($ENV{'GSDLHOME'}, "bin", $ENV{'GSDLOS'}, "wget");
    134141    $command = "\"$wget_file_path\" $cmdWget |";
     
    147154
    148155    close(WIN);
    149 
     156    if ($changed_dir) {
     157    chdir $current_dir;
     158    }
     159   
    150160    return $strReadIn;
    151161}
Note: See TracChangeset for help on using the changeset viewer.