diff options
author | Joey Hess <joey@kodama.kitenet.net> | 2008-10-17 19:53:04 -0400 |
---|---|---|
committer | Joey Hess <joey@kodama.kitenet.net> | 2008-10-17 19:53:04 -0400 |
commit | 16d51e67a7e7257739e1cb3f9a3713d448065e5d (patch) | |
tree | 0adc6d6abeda8f500a5656a7253da166a03f5d6e | |
parent | 578a4873535cb134229b4669e87a09e791b8530d (diff) |
add_underlay: avoid adding the same underlay twice
-rw-r--r-- | IkiWiki.pm | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/IkiWiki.pm b/IkiWiki.pm index 633c51381..edee8aacb 100644 --- a/IkiWiki.pm +++ b/IkiWiki.pm @@ -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; |