avoid dying if cannot chdir to an underlaydir

master
Joey Hess 2010-06-17 16:54:03 -04:00
parent f70bc8184a
commit cb4b999297
3 changed files with 13 additions and 12 deletions

View File

@ -39,7 +39,7 @@ sub refresh () {
my (%pages, %dirs); my (%pages, %dirs);
foreach my $dir ($config{srcdir}, @{$config{underlaydirs}}, $config{underlaydir}) { foreach my $dir ($config{srcdir}, @{$config{underlaydirs}}, $config{underlaydir}) {
chdir($dir) || die "chdir: $!"; chdir($dir) || next;
find({ find({
no_chdir => 1, no_chdir => 1,
@ -64,7 +64,7 @@ sub refresh () {
} }
}, '.'); }, '.');
chdir($origdir) || die "chdir: $!"; chdir($origdir) || die "chdir $origdir: $!";
} }
my %deleted; my %deleted;

View File

@ -669,7 +669,7 @@ sub comments_pending () {
my $extension=shift; my $extension=shift;
return unless -d $dir; return unless -d $dir;
chdir($dir) || die "chdir: $!"; chdir($dir) || die "chdir $dir: $!";
find({ find({
no_chdir => 1, no_chdir => 1,
@ -686,7 +686,7 @@ sub comments_pending () {
} }
}, "."); }, ".");
chdir($origdir) || die "chdir: $!"; chdir($origdir) || die "chdir $origdir: $!";
}; };
$find_comments->($config{srcdir}, "._comment_pending"); $find_comments->($config{srcdir}, "._comment_pending");

View File

@ -335,21 +335,22 @@ sub find_src_files () {
} }
}; };
chdir($config{srcdir}) || die "chdir: $!"; chdir($config{srcdir}) || die "chdir $config{srcdir}: $!";
find({ find({
no_chdir => 1, no_chdir => 1,
wanted => $helper, wanted => $helper,
}, '.'); }, '.');
chdir($origdir) || die "chdir: $!"; chdir($origdir) || die "chdir $origdir: $!";
$underlay=1; $underlay=1;
foreach (@{$config{underlaydirs}}, $config{underlaydir}) { foreach (@{$config{underlaydirs}}, $config{underlaydir}) {
chdir($_) || die "chdir: $!"; if (chdir($_)) {
find({ find({
no_chdir => 1, no_chdir => 1,
wanted => $helper, wanted => $helper,
}, '.'); }, '.');
chdir($origdir) || die "chdir: $!"; chdir($origdir) || die "chdir: $!";
}
}; };
return \@files, \%pages; return \@files, \%pages;