Skip to content

Commit

Permalink
Avoid stating all files in rom dir
Browse files Browse the repository at this point in the history
  • Loading branch information
Arthur Axel 'fREW' Schmidt committed Sep 27, 2015
1 parent 3b17390 commit a37f26d
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/WWW/RetroPie/Game/Picker.pm
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,18 @@ sub dispatch_request {

return $self->_forbidden unless $system =~ m/^[\w]+$/;

my $sysdir = io->dir($self->_config->real_roms_dir, $system);
'/' => sub {
my %links =
map { $_->readlink => 1 }
grep $_->is_link,
io->dir($self->_config->retropie_roms_dir, $system)->all;

my $sysdir_path = $sysdir->name;
my @games = map +{
name => $_->filename,
linked => $links{$_->name}
}, io->dir($self->_config->real_roms_dir, $system)->all;
name => $_,
linked => $links{"$sysdir/$_"}
}, $sysdir->readdir;

$self->_html_200('all_games', {
system => $system,
Expand Down

0 comments on commit a37f26d

Please sign in to comment.