
package Support::LoadHistory::List;

use lib '/app/tools/common/lib';
use Common::XMLObject;
use base 'Common::XMLObject';

use constant kLoadReportPath => '/app/data/load_logs';

sub _init {
    my ( $self, %args ) = @_;

    $self->SUPER::_init(%args);

    # All this will be is a list of files in the load log directory
    #
    my @list;

    opendir( DIR, kLoadReportPath ) or die "ERROR: cannot open directory " . kLoadReportPath . " : $!";
    my $file;
    while ( defined( $file = readdir(DIR) ) ) {
        next if $file =~ /^\./;
        next if $file eq 'load.log';

        # No reason to be cute with this - just report the filename.
        #
        push @list, $file;
    }
    closedir(DIR);

    @list = sort { $b cmp $a } @list;
    unshift @list, 'load.log';

    $self->{LoadFile} = \@list;

    return $self;
}

1;
