Ignore:
Timestamp:
2023-12-06T21:53:42+13:00 (7 months ago)
Author:
anupama
Message:

Tidying up cached filename paths that were internally duplicated. Thsi is the longer code that I've tested more thoroughly. I've now also added in the subroutine that Dr Bainbridge wanted with a hashmap that cleans up the filepath based on matching regex prefixes and determines the new relative file location and filename inside the cached subdirectory based on which regex in the hashmap matched. I will commit the longer code first (and the new function with the described hashmap, but it doesn't get called in this commit), in case I need to backtrack at any point. I will next commit the call to the function and remove the longer code.

File:
1 edited

Legend:

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

    r38165 r38476  
    213213    my ($filename_full_path, $filename_encoded_full_path, $doc_obj, $section, $filename_encoding) = @_;
    214214
     215    print STDERR "##### generate_images: filename full path = $filename_full_path\n";
     216   
    215217    my ($unused_fefp,$filename_encoded_no_path)
    216218    = &util::get_full_filenames("",$filename_encoded_full_path);
     
    230232
    231233    if ($self->{'enable_cache'}) {
    232     $self->init_cache_for_file($filename_full_path);
     234
     235    if($self->{'orig_filename_full_path'}) {
     236        my ($orig_file_root, $orig_dirname, $orig_suffix)
     237        #= &File::Basename::fileparse($doc_obj->{'orig_source_filename'}, "\\.[^\\.]+\$");
     238        = &File::Basename::fileparse($self->{'orig_filename_full_path'}, "\\.[^\\.]+\$");
     239   
     240        $self->init_cache_for_file($filename_full_path, $orig_file_root);
     241    } else {
     242        $self->init_cache_for_file($filename_full_path);
     243    }
    233244    }
    234245    if ($self->{'store_file_paths'}) {
Note: See TracChangeset for help on using the changeset viewer.