+
+if ($ENV{INSTALLED_TESTS}) {
+ foreach my $libdir (@INC) {
+ my $wanted = sub {
+ return unless /\.pm$/;
+ my $name = $File::Find::name;
+ if ($name =~ s{^\Q$libdir/\E}{}) {
+ push @libs, $name;
+ }
+ };
+
+ if (-e "$libdir/IkiWiki.pm" && -d "$libdir/IkiWiki") {
+ find($wanted, "$libdir/IkiWiki");
+ last;
+ }
+ }
+}
+else {
+ my $cwd = getcwd;
+ my $wanted = sub {
+ return unless /\.pm$/;
+ my $name = $File::Find::name;
+ if ($name =~ s{^\Q$cwd/\E}{}) {
+ push @libs, $name;
+ }
+ };
+ find($wanted, "$cwd/IkiWiki");
+}