- return "$config{underlaydir}/$file" if -e "$config{underlaydir}/$file";
- error("internal error: $file cannot be found in $config{srcdir} or $config{underlaydir}");
+ foreach my $dir (@{$config{underlaydirs}}, $config{underlaydir}) {
+ return "$dir/$file" if -e "$dir/$file";
+ }
+ error("internal error: $file cannot be found in $config{srcdir} or underlay");
+ return;
+} #}}}
+
+sub add_underlay ($) { #{{{
+ my $dir=shift;
+
+ if ($dir=~/^\//) {
+ unshift @{$config{underlaydirs}}, $dir;
+ }
+ else {
+ unshift @{$config{underlaydirs}}, "$config{underlaydir}/../$dir";
+ }
+
+ return 1;