Changeset 7932


Ignore:
Timestamp:
2004-08-12T11:46:31+12:00 (20 years ago)
Author:
mdewsnip
Message:

A first cut at modifying RecPlug to resolve Windows shortcuts successfully. Hasn't had much testing but seems to work OK. It uses a Win32::Shortcut module (Windows only, obviously).

File:
1 edited

Legend:

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

    r7688 r7932  
    192192    my $verbosity = $self->{'verbosity'};
    193193    my $read_metadata_files = $self->{'use_metadata_files'};
    194    
     194
    195195    # Calculate the directory name and ensure it is a directory and
    196196    # that it is not explicitly blocked.
     
    199199    return undef unless (-d $dirname);
    200200    return 0 if ($self->{'block_exp'} ne "" && $dirname =~ /$self->{'block_exp'}/);
    201    
     201
    202202    # check to make sure we're not reading the archives or index directory
    203203    my $gsdlhome = quotemeta($ENV{'GSDLHOME'});
     
    299299
    300300    my $subfile = $dir[$i];
     301    my $this_file_base_dir = $base_dir;
    301302    last if ($maxdocs != -1 && $count >= $maxdocs);
    302303    next if ($subfile =~ /^\.\.?$/);
    303304    next if ($read_metadata_files && $subfile =~ /metadata\.xml$/);
     305
     306    # Follow Windows shortcuts
     307    if ($subfile =~ /(?i)\.lnk$/ && $ENV{'GSDLOS'} =~ /^windows$/i) {
     308        require Win32::Shortcut;
     309        my $shortcut = new Win32::Shortcut(&util::filename_cat($dirname, $subfile));
     310        if ($shortcut) {
     311        # The file to be processed is now the target of the shortcut
     312        $this_file_base_dir = "";
     313        $file = "";
     314        $subfile = $shortcut->Path;
     315        }
     316    }
    304317
    305318    # check for a symlink pointing back to a leading directory
     
    345358    print $outhandle "RecPlug recurring: $subfile\n" if ($verbosity > 2);
    346359
    347     $count += &plugin::read ($pluginfo, $base_dir,
     360    $count += &plugin::read ($pluginfo, $this_file_base_dir,
    348361                 &util::filename_cat($file, $subfile),
    349362                 $out_metadata, $processor, $maxdocs, $gli);
Note: See TracChangeset for help on using the changeset viewer.