From 4b3e57a113f6d8b2d940aff721c117cba04423b1 Mon Sep 17 00:00:00 2001 From: Daniel Friesel Date: Mon, 18 Oct 2010 21:05:14 +0200 Subject: checklinks: Workaround to conserve BC for previous commit (absolute $etc) --- bin/checklinks | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) (limited to 'bin') diff --git a/bin/checklinks b/bin/checklinks index 97137b0..29d676b 100755 --- a/bin/checklinks +++ b/bin/checklinks @@ -11,7 +11,7 @@ use Term::ANSIColor; my $base = $ENV{HOME}; my $msglevel = 0; my $remove = 0; -my %substitute; +my (%substitute, %bc_subst); my $linkfile; my $exit = 0; my $ct_auto = 0; @@ -182,6 +182,16 @@ GetOptions( 'r|remove' => \$remove, ); +foreach my $key (keys %substitute) { + + my $path = $substitute{$key}; + + $path =~ s/ ^ $ENV{HOME}//x; + + $bc_subst{$key} = $path; + +} + if ($ct_auto) { loop_links(); exit 0; @@ -195,7 +205,13 @@ while (my $line = <$links>) { chomp($line); foreach my $key (keys(%substitute)) { - $line =~ s/\$$key/$substitute{$key}/g; + + if ($line =~ / ^ \S+ \s+ \S+ \s+ \$ /x) { + $line =~ s/\$$key/$substitute{$key}/g; + } + else { + $line =~ s/\$$key/$bc_subst{$key}/g; + } } my ($type, $src, $dst) = split(/\s+/, $line); -- cgit v1.2.3