Skip to content

Commit

Permalink
Item13677: Load spec files in extension name order
Browse files Browse the repository at this point in the history
UI tabs are arranged in order of extension name. So need to find all the
files, then sort by extension and load them.
  • Loading branch information
gac410 committed Dec 15, 2015
1 parent 2b68b35 commit 837ccb8
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions core/lib/Foswiki/Configure/LoadSpec.pm
Expand Up @@ -120,18 +120,24 @@ sub readSpec {
)
{

_loadSpecsFrom( "$dir/$subdir", $root, \%read, $reporter );
_findSpecsFrom( "$dir/$subdir", $root, \%read, $reporter );
}
}

foreach my $file ( sort keys %read ) {
parse( $read{$file}, $root, $reporter );
}

}

sub _loadSpecsFrom {
sub _findSpecsFrom {
my ( $dir, $root, $read, $reporter ) = @_;

return unless opendir( D, $dir );

# note we ignore specs from any extension where the name starts
# with "Empty" e.g. EmptyPlugin, EmptyContrib
my @specfiles;
foreach my $extension ( sort grep { !/^\./ && !/^Empty/ } readdir D ) {

next if $read->{$extension};
Expand All @@ -140,7 +146,6 @@ sub _loadSpecsFrom {
$extension = $1; # untaint
my $file = "$dir/$extension/Config.spec";
next unless -e $file;
parse( $file, $root, $reporter );
$read->{$extension} = $file;
}
closedir(D);
Expand Down

0 comments on commit 837ccb8

Please sign in to comment.