Changeset 16442

Show
Ignore:
Timestamp:
16.07.2008 18:44:44 (11 years ago)
Author:
ak19
Message:

Fixed yesterday's adjustment to envvar_prepend and envvar_append to work on Windows now (escapes windows backslashes in paths).

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/util.pm

    r16436 r16442  
    627627    my ($var,$val) = @_; 
    628628 
    629     my $current_val = $ENV{$var}; 
    630      
    631629    # do not prepend any value/path that's already in the environment variable 
    632     if($ENV{$var} !~ m/$val/) {  
    633     if ($ENV{'GSDLOS'} =~ /^windows$/i) { 
    634         $ENV{$var} .= "$val;$current_val"; 
    635     } 
    636     else { 
    637         $ENV{$var} .= "$val:$current_val"; 
     630    if ($ENV{'GSDLOS'} =~ /^windows$/i)  
     631    { 
     632    my $escaped_val = $val; 
     633    $escaped_val =~ s/\\/\\\\/g; # escape any Windows backslashes for upcoming regex 
     634    if($ENV{$var} !~ m/$escaped_val/) {  
     635        $ENV{$var} = "$val;".$ENV{$var}; 
     636    } 
     637    } 
     638    else { 
     639    if($ENV{$var} !~ m/$val/) {  
     640        $ENV{$var} = "$val:".$ENV{$var}; 
    638641    } 
    639642    } 
     
    644647 
    645648    # do not append any value/path that's already in the environment variable 
    646     if($ENV{$var} !~ m/$val/) {  
    647     if ($ENV{'GSDLOS'} =~ /^windows$/i) { 
     649    if ($ENV{'GSDLOS'} =~ /^windows$/i)  
     650    { 
     651    my $escaped_val = $val; 
     652    $escaped_val =~ s/\\/\\\\/g; # escape any Windows backslashes for upcoming regex 
     653    if($ENV{$var} !~ m/$escaped_val/) {  
    648654        $ENV{$var} .= ";$val"; 
    649655    } 
    650     else { 
     656    } 
     657    else { 
     658    if($ENV{$var} !~ m/$val/) {  
    651659        $ENV{$var} .= ":$val"; 
    652660    } 
    653     } 
    654 } 
     661    }     
     662} 
     663 
    655664 
    656665# splits a filename into a prefix and a tail extension using the tail_re, or