Changeset 22438


Ignore:
Timestamp:
2010-07-19T16:00:18+12:00 (12 years ago)
Author:
davidb
Message:

Additional flexibility added in to how get_tmp_filename works with extension value passed in

File:
1 edited

Legend:

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

    r22386 r22438  
    634634    my $file_ext = shift(@_) || undef;
    635635
    636     my $opt_dot_file_ext = (defined $file_ext) ? ".$file_ext" : "";
     636    my $opt_dot_file_ext = "";
     637    if (defined $file_ext) {
     638    if ($file_ext !~ m/\./) {
     639        # no dot, so needs one added in at start
     640        $opt_dot_file_ext = ".$file_ext"
     641    }
     642    else {
     643        # allow for "extensions" such as _metadata.txt to be handled
     644        # gracefully
     645        $opt_dot_file_ext = $file_ext;
     646    }
     647    }
    637648
    638649    my $tmpdir = filename_cat($ENV{'GSDLHOME'}, "tmp");
Note: See TracChangeset for help on using the changeset viewer.