Changeset 23278

Show
Ignore:
Timestamp:
03.11.2010 10:45:43 (9 years ago)
Author:
kjdon
Message:

split out the encoding filename bit from set_source_metadata so that other places can use it

Files:
1 modified

Legend:

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

    r23131 r23278  
    167167 
    168168    # URLencode just the gsdl_source_filename, not the directory. Then prepend dir  
    169     my ($srcfilename,$dirname,$suffix)  
    170     = &File::Basename::fileparse($source_filename, "\\.[^\\.]+\$"); 
     169    $source_filename = $self->encode_filename($source_filename, $rename_method); 
     170#    my ($srcfilename,$dirname,$suffix)  
     171#   = &File::Basename::fileparse($source_filename, "\\.[^\\.]+\$"); 
    171172#    print STDERR "-> $srcfilename -> "; 
    172     $srcfilename = &util::rename_file($srcfilename.$suffix, $rename_method); 
    173     $source_filename = &util::filename_cat($dirname, $srcfilename); 
     173#    $srcfilename = &util::rename_file($srcfilename.$suffix, $rename_method); 
     174#    $source_filename = &util::filename_cat($dirname, $srcfilename); 
    174175#    print STDERR "$source_filename\n"; 
    175176     
     
    177178                 "gsdlsourcefilename",  
    178179                 $source_filename); 
     180} 
     181 
     182sub encode_filename { 
     183    my $self = shift (@_); 
     184    my ($source_filename, $rename_method) = @_; 
     185 
     186     my ($srcfilename,$dirname,$suffix)  
     187    = &File::Basename::fileparse($source_filename, "\\.[^\\.]+\$"); 
     188#    print STDERR "-> $srcfilename -> "; 
     189    $srcfilename = &util::rename_file($srcfilename.$suffix, $rename_method); 
     190    $source_filename = &util::filename_cat($dirname, $srcfilename); 
     191 
     192    return $source_filename; 
    179193} 
    180194