Changeset 28236

Show
Ignore:
Timestamp:
06.09.2013 18:29:14 (6 years ago)
Author:
ak19
Message:

Added a parameter to specify whether paths on windows should be converted to long filenames or short (default is short) before getting being replaced by placeholders or when placeholders are replaced by absolute paths.

Files:
1 modified

Legend:

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

    r28228 r28236  
    12971297sub abspath_to_placeholders { 
    12981298    my $path = shift(@_); # path to convert from absolute to one with placeholders 
     1299    my $opt_long_or_short_winfilenames = shift(@_) || "short"; # whether we want to force use of long file names even on windows, default uses short 
    12991300 
    13001301    return $path unless is_abs_path_any_os($path); # path is relative 
     1302 
     1303    if ($opt_long_or_short_winfilenames eq "long") { 
     1304    $path = &util::upgrade_if_dos_filename($path); # will only do something on windows 
     1305    } 
    13011306     
    13021307    # now we know we're dealing with absolute paths and have to replace gs prefixes with placeholders 
     
    13111316    $path = &util::_abspath_to_placeholders($path, \@gs_paths, \%placeholder_map); 
    13121317 
    1313     if ($ENV{'GSDLOS'} =~ /^windows$/i) { 
     1318    if ($ENV{'GSDLOS'} =~ /^windows$/i && $opt_long_or_short_winfilenames eq "short") { 
    13141319    # for windows need to look for matches on short file names too 
    13151320    # matched paths are again to be replaced with the usual placeholders 
     
    13631368sub placeholders_to_abspath { 
    13641369    my $path = shift(@_); # path that can contain placeholders to convert to resolved absolute path 
     1370    my $opt_long_or_short_winfilenames = shift(@_) || "short"; # whether we want to force use of long file names even on windows, default uses short 
    13651371 
    13661372    return $path if($path !~ m/@/); # path contains no placeholders 
     
    13721378    # can't use double-quotes around at-sign, else perl tries to evaluate it as referring to an array 
    13731379    my %placeholder_to_gspath_map; 
    1374     if ($ENV{'GSDLOS'} =~ /^windows$/i) { 
     1380    if ($ENV{'GSDLOS'} =~ /^windows$/i && $opt_long_or_short_winfilenames eq "short") { 
    13751381    # always replace placeholders with short file names of the absolute paths on windows? 
    13761382    %placeholder_to_gspath_map = ('@GSDLHOME@' => &util::downgrade_if_dos_filename($ENV{'GREENSTONEHOME'}),