From 2fe5383f36780a06574ea3a46e7d4d62ee4111a0 Mon Sep 17 00:00:00 2001 From: Mark Wooding Date: Mon, 12 Jun 2023 11:30:35 +0100 Subject: [PATCH] mason/dhandler (.contact): Recurse into first folder to find index image. This isn't always the best choice, but it's better than the plain folder icon. --- mason/dhandler | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/mason/dhandler b/mason/dhandler index d36722b..42b324c 100755 --- a/mason/dhandler +++ b/mason/dhandler @@ -88,10 +88,17 @@ Failed to find ‘<% $path |h %>’. for my $f (@$ff) { $tn{$f} = TrivGal::Image->new($path . $f->name); } for my $d (@$dd) { - my ($ddd, $fff, $iii) = listdir $real . "/" . $d->name; - $tn{$d} = $iii ? - TrivGal::Image->new(join_paths $path, $d->name, $iii->name) : - undef; + my $p = join_paths $path, $d->name; + DIR: for (;;) { + my ($ddd, $fff, $iii) = listdir join_paths $IMGROOT, $p; + if (defined $iii) { + my $index = join_paths $p, $iii->name; + $tn{$d} = TrivGal::Image->new($index); + last DIR; + } + if (!@$ddd) { $tn{$d} = undef; last DIR; } + $p = join_paths $p, $ddd->[0]->name; + } } % -- 2.11.0