Changeset 22438

Show
Ignore:
Timestamp:
19.07.2010 16:00:18 (10 years ago)
Author:
davidb
Message:

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

Files:
1 modified

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");