From: Aman Gupta Date: Sat, 22 Aug 2009 12:07:26 +0000 (+0200) Subject: contrib/collection3: Common.pm: Sort identifiers by filename. X-Git-Tag: collectd-4.6.5~17 X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1b0c4dd4a9426da7d0c8eecffc55c42551ba3080;p=collectd.git contrib/collection3: Common.pm: Sort identifiers by filename. --- diff --git a/contrib/collection3/lib/Collectd/Graph/Common.pm b/contrib/collection3/lib/Collectd/Graph/Common.pm index b445c8e4..6019edb4 100644 --- a/contrib/collection3/lib/Collectd/Graph/Common.pm +++ b/contrib/collection3/lib/Collectd/Graph/Common.pm @@ -216,6 +216,7 @@ sub get_files_from_directory my $recursive = @_ ? shift : 0; my $dh; my @directories = (); + my @files = (); my $ret = []; opendir ($dh, $dir) or die ("opendir ($dir): $!"); @@ -231,15 +232,13 @@ sub get_files_from_directory } elsif (-f $entry) { - my $ident = filename_to_ident ($entry); - if ($ident) - { - push (@$ret, $ident); - } + push (@files, $entry); } } closedir ($dh); + push (@$ret, map { filename_to_ident ($_) } sort (@files)); + if ($recursive > 0) { for (@directories) @@ -247,7 +246,7 @@ sub get_files_from_directory my $temp = get_files_from_directory ($_, $recursive - 1); if ($temp && @$temp) { - push (@$ret, @$temp); + push (@$ret, @$temp); } } }