Changeset 22886


Ignore:
Timestamp:
2010-09-13T11:00:21+12:00 (12 years ago)
Author:
kjdon
Message:

new method get_timestamped_tmp_folder, used by ConvertBinaryFile and get_timestamped_tmp_filename_in_collection

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/perllib/util.pm

    r22883 r22886  
    663663}
    664664
    665 sub get_timestamped_tmp_filename_in_collection
     665sub get_timestamped_tmp_folder
    666666{
    667667
    668     my ($input_filename, $output_ext) = @_;
    669     # derive tmp filename from input filename
    670     my ($tailname, $dirname, $suffix)
    671     = &File::Basename::fileparse($input_filename, "\\.[^\\.]+\$");
    672 
    673     # softlink to collection tmp dir
    674     my $tmp_dirname = $dirname;
     668    my $tmp_dirname;
    675669    if(defined $ENV{'GSDLCOLLECTDIR'}) {
    676670    $tmp_dirname = $ENV{'GSDLCOLLECTDIR'};
    677671    } elsif(defined $ENV{'GSDLHOME'}) {
    678672    $tmp_dirname = $ENV{'GSDLHOME'};
     673    } else {
     674    return undef;
    679675    }
    680676
     
    694690    &util::mk_dir($tmp_dirname);
    695691 
     692    return $tmp_dirname;
     693}
     694
     695sub get_timestamped_tmp_filename_in_collection
     696{
     697
     698    my ($input_filename, $output_ext) = @_;
     699    # derive tmp filename from input filename
     700    my ($tailname, $dirname, $suffix)
     701    = &File::Basename::fileparse($input_filename, "\\.[^\\.]+\$");
     702
     703    # softlink to collection tmp dir
     704    my $tmp_dirname = &util::get_timestamped_tmp_folder();
     705    $tmp_dirname = $dirname unless defined $tmp_dirname;
    696706
    697707    # following two steps copied from ConvertBinaryFile
     708    # do we need them?? can't use them as is, as they use plugin methods.
     709
    698710    #$tailname = $self->SUPER::filepath_to_utf8($tailname) unless &unicode::check_is_utf8($tailname);
    699711
Note: See TracChangeset for help on using the changeset viewer.