Changeset 2795


Ignore:
Timestamp:
2001-10-12T11:05:43+13:00 (23 years ago)
Author:
sjboddie
Message:

Got ZIPPlug working under under windows

Location:
trunk/gsdl/perllib
Files:
5 edited

Legend:

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

    r2785 r2795  
    262262    my $outhandle = $self->{'outhandle'};
    263263
    264     my $filename = &util::filename_cat($base_dir, $file);
     264    my $filename = $file;
     265    $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
     266
    265267    if ($self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/) {
    266268    $self->{'num_blocked'} ++;
     
    695697}
    696698
    697 
    6986991;
  • trunk/gsdl/perllib/plugins/GMLPlug.pm

    r2363 r2795  
    5757    my $outhandle = $self->{'outhandle'};
    5858
    59     my $filename = &util::filename_cat($base_dir, $file);
     59    my $filename = $file;
     60    $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
     61
    6062    return 0 if $self->{'block_exp'} ne "" && $filename =~ /$self->{'block_exp'}/;
    6163    if ($filename !~ /$self->{'process_exp'}/ || !-f $filename) {
  • trunk/gsdl/perllib/plugins/RecPlug.pm

    r2228 r2795  
    156156    # Calculate the directory name and ensure it is a directory and
    157157    # that it is not explicitly blocked.
    158     $file =~ s/^[\/\\]+//;
    159     my $dirname = &util::filename_cat ($base_dir, $file);
     158    my $dirname = $file;
     159    $dirname = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
    160160    return undef unless (-d $dirname);
    161161    return 0 if ($self->{'block_exp'} ne "" && $dirname =~ /$self->{'block_exp'}/);
    162 
    163162
    164163    # check to make sure we're not reading the archives or index directory
  • trunk/gsdl/perllib/plugins/ZIPPlug.pm

    r2785 r2795  
    4343# tar (for tar)
    4444
    45 # ZIPPlug is currently disabled on windows as we can't expect any of the
    46 # above utilities to be present on that OS. We should probably provide
    47 # binaries with Greenstone some day.
    48 
    4945package ZIPPlug;
    5046
     
    8177    my $outhandle = $self->{'outhandle'};
    8278
    83     # disabled on windows
    84     return undef if ($ENV{'GSDLOS'} =~ /^windows$/i);
    85 
    8679    if ($file =~ /\.(gz|tgz|z|taz|bz|bz2|zip|jar|tar)$/i) {
    8780
    88     my $filename = &util::filename_cat ($base_dir, $file);
     81    my $filename = $file;
     82    $filename = &util::filename_cat ($base_dir, $file) if $base_dir =~ /\w/;
    8983    if (!-e $filename) {
    9084        print $outhandle "ZIPPLug: WARNING: $filename does not exist\n";
     
    132126    my $self = shift (@_);
    133127    my ($file) = @_;
     128
    134129    if (system ("bunzip $file")!=0)
    135130    {
     
    141136    my $self = shift (@_);
    142137    my ($file) = @_;
     138
    143139    if (system ("bunzip2 $file")!=0)
    144140    {
     
    150146    my $self = shift (@_);
    151147    my ($file) = @_;
     148
    152149    system ("unzip $file");
    153150    &util::rm ($file) if -e $file;
     
    157154    my $self = shift (@_);
    158155    my ($file) = @_;
     156
    159157    system ("tar xf $file");
    160158    &util::rm ($file) if -e $file;
     
    164162    my $self = shift (@_);
    165163    my ($file) = @_;
     164
    166165    if (system ("gunzip $file")!=0)
    167166    {
  • trunk/gsdl/perllib/util.pm

    r2516 r2795  
    475475
    476476sub get_tmp_filename {
    477     my $tmpdir = "$ENV{'GSDLHOME'}/tmp";
     477    my $tmpdir = filename_cat($ENV{'GSDLHOME'}, "tmp");
    478478    &mk_all_dir ($tmpdir) unless -e $tmpdir;
    479479
    480480    my $count = 1000;
    481481    my $rand = int(rand $count);
    482     while (-e "$tmpdir/F$rand") {
     482    while (-e &filename_cat($tmpdir, "F$rand")) {
    483483    $rand = int(rand $count);
    484484    $count++;
    485485    }
    486486
    487     return "$tmpdir/F$rand";
     487    return filename_cat($tmpdir, "F$rand");
    488488}
    489489
Note: See TracChangeset for help on using the changeset viewer.