Changeset 16392 for gsdl/trunk/perllib/plugins/ZIPPlugin.pm
- Timestamp:
- 2008-07-14T14:57:38+12:00 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gsdl/trunk/perllib/plugins/ZIPPlugin.pm
r15880 r16392 101 101 sub read { 102 102 my $self = shift (@_); 103 my ($pluginfo, $base_dir, $file, $ metadata, $processor, $maxdocs, $total_count, $gli) = @_;103 my ($pluginfo, $base_dir, $file, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli) = @_; 104 104 my $outhandle = $self->{'outhandle'}; 105 105 106 # c heck process_exp, block_exp, associate_ext etc107 my ($ block_status,$filename) = $self->read_block(@_);108 return $block_status if ((!defined $block_status) || ($block_status==0));106 # can we process this file?? 107 my ($filename_full_path, $filename_no_path) = &util::get_full_filenames($base_dir, $file); 108 return undef unless $self->can_process_this_file($filename_full_path); 109 109 110 my ($file_only) = $file =~ /([^\\\/]*)$/;111 110 my $tmpdir = &util::get_tmp_filename (); 112 111 &util::mk_all_dir ($tmpdir); 113 112 114 print $outhandle "ZIPPlugin: extracting $file _onlyto $tmpdir\n"113 print $outhandle "ZIPPlugin: extracting $filename_no_path to $tmpdir\n" 115 114 if $self->{'verbosity'} > 1; 116 115 … … 118 117 my $cwd = cwd(); 119 118 chdir ($tmpdir) || die "Unable to change to $tmpdir"; 120 &util::cp ($filename , $tmpdir);119 &util::cp ($filename_full_path, $tmpdir); 121 120 122 121 if ($file =~ /\.bz$/i) { 123 $self->bunzip ($file _only);122 $self->bunzip ($filename_no_path); 124 123 } elsif ($file =~ /\.bz2$/i) { 125 $self->bunzip2 ($file _only);124 $self->bunzip2 ($filename_no_path); 126 125 } elsif ($file =~ /\.(zip|jar)$/i) { 127 $self->unzip ($file _only);126 $self->unzip ($filename_no_path); 128 127 } elsif ($file =~ /\.tar$/i) { 129 $self->untar ($file _only);128 $self->untar ($filename_no_path); 130 129 } else { 131 $self->gunzip ($file _only);130 $self->gunzip ($filename_no_path); 132 131 } 133 132 134 133 chdir ($cwd) || die "Unable to change back to $cwd"; 135 134 136 my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $ metadata, $processor, $maxdocs, $total_count, $gli);135 my $numdocs = &plugin::read ($pluginfo, "", $tmpdir, $block_hash, $metadata, $processor, $maxdocs, $total_count, $gli); 137 136 &util::rm_r ($tmpdir); 138 137
Note:
See TracChangeset
for help on using the changeset viewer.