Ignore:
Timestamp:
2010-04-28T15:53:16+12:00 (14 years ago)
Author:
kjdon
Message:

fix for ticket #676. Conversion of pdf to html where two pdfs had the same name would result in the second one overwriting images in hte first one. Fixed by converting in a timestamped folder inside tmp, so no longer in the same folder.

File:
1 edited

Legend:

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

    r21760 r21981  
    265265    $tmp_dirname = $ENV{'GSDLHOME'};
    266266    }
     267
    267268    $tmp_dirname = &util::filename_cat($tmp_dirname, "tmp");
    268269    &util::mk_dir($tmp_dirname) if (!-e $tmp_dirname);
    269    
     270
     271    # add the timestamp into the path otherwise we can run into problems
     272    # if documents have the same name
     273    my $timestamp = time;
     274    my $time_tmp_dirname = &util::filename_cat($tmp_dirname, $timestamp);
     275    $tmp_dirname = $time_tmp_dirname;
     276    my $i = 1;
     277    while (-e $tmp_dirname) {
     278    $tmp_dirname = "$time_tmp_dirname$i";
     279    $i++;
     280    }
     281    &util::mk_dir($tmp_dirname);
     282
    270283    # The following is not necessary and will cause problems with
    271284    # replacing_srcdoc_with_html in the GSDLremote case:
Note: See TracChangeset for help on using the changeset viewer.