sub refresh () {
eval q{use File::Find};
error($@) if $@;
+ eval q{use Cwd};
+ error($@) if $@;
+ my $origdir=getcwd();
my (%pages, %dirs);
foreach my $dir ($config{srcdir}, @{$config{underlaydirs}}, $config{underlaydir}) {
+ chdir($dir) || next;
+
find({
no_chdir => 1,
wanted => sub {
my $file=decode_utf8($_);
- $file=~s/^\Q$dir\E\/?//;
+ $file=~s/^\.\/?//;
return unless length $file;
- if (IkiWiki::file_pruned($_)) {
+ if (IkiWiki::file_pruned($file)) {
$File::Find::prune=1;
}
elsif (! -l $_) {
}
}
}
- }, $dir);
+ }, '.');
+
+ chdir($origdir) || die "chdir $origdir: $!";
}
my %deleted;