Changeset 24350 for main


Ignore:
Timestamp:
2011-07-29T13:16:32+12:00 (13 years ago)
Author:
davidb
Message:

Tweak on working out what the output-cached directory should be for a given file which allows for input files to already be in the output-cache area, rather than (as is more usual) be in the 'import' folder

File:
1 edited

Legend:

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

    r22431 r24350  
    8484    my $outhandle = $self->{'outhandle'};
    8585    my $base_dir = $self->{'base_dir'};
     86
     87    my $collect_dir = $ENV{'GSDLCOLLECTDIR'};
     88    $collect_dir =~ s/\\/\//g; # Work in Unix style world
    8689   
     90##    print STDERR "**** base_dir = ", $base_dir, "\n";
     91 
    8792    # Work out relative filename within 'base_dir'
    8893    $filename =~ s/\\/\//g;
    8994    my ($file) = ($filename =~ m/^$base_dir(.*?)$/);
    9095   
     96    if (!defined $file) {
     97    # Perhaps the filename is taken from within cache_dir area?
     98    my $prev_cached_dir = $self->{'cached_dir'};
     99    ($file) = ($filename =~ m/^$prev_cached_dir(.*?)$/);
     100    }
     101
    91102    $file =~ s/^\/|\\//; # get rid of leading slash from relative filename
     103
    92104
    93105    # Setup cached_dir and file_root
     
    96108    = &File::Basename::fileparse($file, "\\.[^\\.]+\$");
    97109
    98     my $collect_dir = $ENV{'GSDLCOLLECTDIR'};
    99     $collect_dir =~ s/\\/\//g; # Work in Unix style world
    100110
    101111    # if dirname is in collections tmp area, remove collect_dir prefix
Note: See TracChangeset for help on using the changeset viewer.