From 1b0c4dd4a9426da7d0c8eecffc55c42551ba3080 Mon Sep 17 00:00:00 2001 From: Aman Gupta Date: Sat, 22 Aug 2009 14:07:26 +0200 Subject: [PATCH] contrib/collection3: Common.pm: Sort identifiers by filename. --- contrib/collection3/lib/Collectd/Graph/Common.pm | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) 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); } } } -- 2.11.0