Subject: | original sharedirs are not searched first |
The original versions of dist_dir() and module_dir() are not called first, to see if the directory exists -- therefore a tempdir is created even when it is not necessary, for example when running tests via Dist::Zilla (which copies sharedirs into the right place).
I *think* all that is necessary is to do this in Test::File::ShareDir::TempDirObject:
sub _module_tempdir {
my ($self) = shift;
+ my $orig_dir = File::ShareDir::_module_dir_new($self);
+ return $orig_dir if defined $orig_dir;
return $self->{module_tempdir} if exists $self->{module_tempdir};
$self->{module_tempdir} = $self->_tempdir->subdir('auto/share/module');
$self->{module_tempdir}->mkpath();
return $self->{module_tempdir}->absolute;
}
sub _dist_tempdir {
my ($self) = shift;
+ my $orig_dir = File::ShareDir::_dist_dir_new($self);
+ return $orig_dir if defined $orig_dir;
return $self->{dist_tempdir} if exists $self->{dist_tempdir};
$self->{dist_tempdir} = $self->_tempdir->subdir('auto/share/dist');
$self->{dist_tempdir}->mkpath();
return $self->{dist_tempdir}->absolute;
}