my ($self, $path) = @_;
my @files = ();
- my @dirs = io->dir($path)->splitdir;
+ my @dir_parts = io->dir($path)->splitdir;
- shift @dirs;
- pop @dirs;
- my $build_path = io('');
+ my @dirs = map io->dir('')->catdir(@dir_parts[1..$_]), 1..($#dir_parts - 1);
- foreach my $dir (@dirs) {
- $build_path = $build_path->catdir("/$dir");
- #/home/.../share/pages/blog.conf etc
-
- my $file = $self->_top_dir->catfile("$build_path.conf");
-
- if (!$file->exists || !$file->file || $file->empty) {
- next;
- }
-
- push @files, $file;
- }
-
- return \@files;
+ return grep +($_->file and not $_->empty),
+ map $self->_top_dir->catfile("${_}.conf"), @dirs;
}
sub _inflate {