From 0aba71343d1d63acf3d0ca884c764c6a28dfbcbf Mon Sep 17 00:00:00 2001 From: dakkar Date: Sun, 3 Apr 2022 14:57:03 +0100 Subject: try to avoid calling `.d` on a non-existent file there's always races between this program and whatever is modifying the filesystem! --- lib/App/MediaControl.rakumod | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'lib/App/MediaControl.rakumod') diff --git a/lib/App/MediaControl.rakumod b/lib/App/MediaControl.rakumod index a13c538..d330221 100644 --- a/lib/App/MediaControl.rakumod +++ b/lib/App/MediaControl.rakumod @@ -49,8 +49,6 @@ class App::MediaControl { when $item ~~ $root {} when $item ~~ ScanDir::End { $!db.remove-unseen(); say "scan done" } - next unless $item.d || $item.extension ~~ $extensions; - my $path = $item.parent.relative($root); $path = '' if $path eq '.'; my $name = $item.basename; @@ -60,7 +58,9 @@ class App::MediaControl { } else { my $is-dir = $item.d; - $!db.add-entry(:$path,:$name,:$is-dir); + if $is-dir || $item.extension ~~ $extensions { + $!db.add-entry(:$path,:$name,:$is-dir); + } } } } -- cgit v1.2.3