Ignore:
Timestamp:
2010-12-09T00:10:10+13:00 (13 years ago)
Author:
max
Message:

Setting the values to store as block files is now done through an API call to BasePlugin. This way, anything uniform requirement (such as putting in both C:\... and c:\... entries for Windows) can be done in one place.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/plugins/BasePlugin.pm

    r23418 r23419  
    382382}
    383383
     384sub block_filename
     385{
     386    my $self = shift(@_);
     387    my ($block_hash,$filename) = @_;
     388   
     389    if ($ENV{'GSDLOS'} =~ m/^windows$/) {
     390       
     391        my $lower_drive = $filename;
     392        $lower_drive =~ s/^([A-Z]):/\l$1:/i;
     393       
     394        my $upper_drive = $filename;
     395        $upper_drive =~ s/^([A-Z]):/\u$1:/i;
     396       
     397        $block_hash->{'file_blocks'}->{$lower_drive} = 1;
     398        $block_hash->{'file_blocks'}->{$upper_drive} = 1;       
     399    }
     400    else {
     401        $block_hash->{'file_blocks'}->{$filename} = 1;
     402    }
     403}
     404
    384405# rename imported files and assoc files using URL encoding by default
    385406# as this will work for most plugins and give more legible filenames
     
    417438
    418439    if ($self->{'block_exp'} ne "" && $filename_full_path =~ /$self->{'block_exp'}/) {
    419     $block_hash->{'file_blocks'}->{$filename_full_path} = 1;
     440    $self->block_filename($block_hash,$filename_full_path);
    420441    }
    421442
     
    437458    }   
    438459    if (&util::fd_exists($coverfile)) {
    439         $block_hash->{'file_blocks'}->{$coverfile} = 1;
     460        $self->block_filename($block_hash,$coverfile);
    440461    }
    441462    }
     
    11691190    my ($textref, $pluginfo, $base_dir, $file, $metadata, $doc_obj, $gli) = @_;
    11701191
    1171     gsprintf(STDERR, "BasePlugin::process {common.must_be_implemented}\n") && die "\n";
     1192    gsprintf(STDERR, "BasePlugin::process {common.must_be_implemented}\n");
     1193
     1194    my ($cpackage,$cfilename,$cline,$csubr,$chas_args,$cwantarray) = caller(1);
     1195    print STDERR "Calling method: $cfilename:$cline $cpackage->$csubr\n";
     1196
     1197    die "\n";
    11721198
    11731199    return undef; # never gets here
Note: See TracChangeset for help on using the changeset viewer.