#!/usr/bin/perl -w
# the only ENV a .app gets are
# HOME LANG PATH SHELL USER __CF_USER_TEXT_ENCODING
use File::Find ();
# for the convenience of &wanted calls, including -eval statements:
use vars qw/*name *dir *prune/;
*name   = *File::Find::name;
*dir    = *File::Find::dir;
*prune  = *File::Find::prune;

open FOUT, ">$ENV{HOME}/Sites/allSysImg.html";

sub wanted {
    /^.*\.(?:png|PNG|gif|GIF|jpeg|JPEG|jpg|JPG)\z/s &&
    print FOUT ($name . "<br>\n<img src=\"file://$name\"><br>\n");
}

print FOUT "<html><head>\n<title></title></head><body bgcolor=\"#ffffff\" text=\"#000000\">\n";
print FOUT "<a href=\"allAppImg.html\">See Also images of /Applications</a>\n";
File::Find::find({wanted => \&wanted}, '/System/Library');
print FOUT "<a href=\"allAppImg.html\">See Also images of /Applications</a>\n";
print FOUT "</body></html>\n";
close FOUT;

open FOUT, ">$ENV{HOME}/Sites/allAppImg.html";
print FOUT "<html><head>\n<title></title></head><body bgcolor=\"#ffffff\" text=\"#000000\">\n";
print FOUT "<a href=\"allSysImg.html\">See Also images of /System/Library</a>\n";
File::Find::find({wanted => \&wanted}, '/Applications');
print FOUT "<a href=\"allSysImg.html\">See Also images of /System/Library</a>\n";
print FOUT "</body></html>\n";
close FOUT;
system "open $ENV{HOME}/Sites/allSysImg.html";
