add_underlay: avoid adding the same underlay twice

master
Joey Hess 2008-10-17 19:53:04 -04:00
parent 578a487353
commit 16d51e67a7
1 changed files with 5 additions and 4 deletions

View File

@ -681,11 +681,12 @@ sub srcfile ($;$) { #{{{
sub add_underlay ($) { #{{{
my $dir=shift;
if ($dir=~/^\//) {
unshift @{$config{underlaydirs}}, $dir;
if ($dir !~ /^\//) {
$dir="$config{underlaydir}/../$dir";
}
else {
unshift @{$config{underlaydirs}}, "$config{underlaydir}/../$dir";
if (! grep { $_ eq $dir } @{$config{underlaydirs}}) {
unshift @{$config{underlaydirs}}, $dir;
}
return 1;