Changeset 7693


Ignore:
Timestamp:
2004-07-02T10:08:04+12:00 (20 years ago)
Author:
mdewsnip
Message:

Improvements to the new code so that it works on Windows as well as Unix.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/gsdl/perllib/plugins/ISISPlug.pm

    r7686 r7693  
    305305        if ($field eq $document_field) {
    306306        my $document_file_full = $document_prefix . $value . $document_suffix;
    307         my ($document_file) = ($document_file_full =~ /([^\/]+)$/);
    308         if (&obtain_document($self, $document_file_full, $document_file,
    309                      $documents_directory)) {
     307
     308        my $document_file = &obtain_document($self, $document_file_full, $documents_directory);
     309        if ($document_file) {
    310310            $document_obtained = 1;
    311311            &write_metadata_xml_file($self->{'documents_metadata_xml_file'},
     
    367367    my $self = shift(@_);
    368368    my $document_file_full = shift(@_);
    369     my $document_file_name = shift(@_);
    370369    my $documents_directory = shift(@_);
    371     my $local_document_file = &util::filename_cat($documents_directory, $document_file_name);
    372370
    373371    my $outhandle = $self->{'outhandle'};
     
    375373    if ($self->{'verbosity'} > 1);
    376374
     375    my $document_file_name;
     376    my $local_document_file;
     377
    377378    # Document specified is on the web
    378379    if ($document_file_full =~ /^http:/ || $document_file_full =~ /^ftp:/) {
     380    $document_file_full =~ /([^\/]+)$/;
     381    $document_file_name = $1;
     382    $local_document_file = &util::filename_cat($documents_directory, $document_file_name);
     383
    379384    my $wget_options = "--quiet";
    380385    $wget_options = "--verbose" if ($self->{'verbosity'} > 2);
     
    384389    # Document specified is on the disk
    385390    else {
     391    my $dir_sep = &util::get_os_dirsep();
     392    $document_file_full =~ /(.+$dir_sep)?(.*)$/;
     393    $document_file_name = $2;
     394    $local_document_file = &util::filename_cat($documents_directory, $document_file_name);
     395
    386396    &util::cp($document_file_full, $documents_directory);
    387397    }
     
    390400    if (!-e $local_document_file) {
    391401    print STDERR "WARNING: Could not obtain document file $document_file_full\n";
    392     return 0;
    393     }
    394 
    395     return 1;
     402    return undef;
     403    }
     404
     405    return $document_file_name;
    396406}
    397407
Note: See TracChangeset for help on using the changeset viewer.