X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=OSX%2Fupdate-info-plist.pl;h=ec8981a1ac759d3b578f044a6d6e579d3b7e53ae;hb=4ade52359b6eba3621566dac79793a33aa4c915f;hp=14b1494a14e350ea17ac267e4bc716130032b464;hpb=c141c2b05e374757b6499d12bb8a6d4d943b1529;p=xscreensaver diff --git a/OSX/update-info-plist.pl b/OSX/update-info-plist.pl index 14b1494a..ec8981a1 100755 --- a/OSX/update-info-plist.pl +++ b/OSX/update-info-plist.pl @@ -1,5 +1,5 @@ #!/usr/bin/perl -w -# Copyright © 2006-2012 Jamie Zawinski +# Copyright © 2006-2013 Jamie Zawinski # # Permission to use, copy, modify, distribute, and sell this software and its # documentation for any purpose is hereby granted without fee, provided that @@ -22,11 +22,15 @@ require 5; #use diagnostics; # Fails on some MacOS 10.5 systems use strict; -my $progname = $0; $progname =~ s@.*/@@g; -my $version = q{ $Revision: 1.22 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; +my ($exec_dir, $progname) = ($0 =~ m@^(.*?)/([^/]+)$@); + +my $version = q{ $Revision: 1.24 $ }; $version =~ s/^[^0-9]+([0-9.]+).*$/$1/; $ENV{PATH} = "/usr/local/bin:$ENV{PATH}"; # for seticon +my $thumbdir = $ENV{HOME} . '/www/xscreensaver/screenshots/'; + + my $verbose = 1; @@ -43,6 +47,7 @@ sub read_info_plist($) { } else { error ("$file: $!"); } + print STDERR "$progname: read $file\n" if ($verbose > 2); local $/ = undef; # read entire file my $body = <$in>; close $in; @@ -78,6 +83,7 @@ sub read_saver_xml($) { } else { error ("$file: $!"); } + print STDERR "$progname: read $file\n" if ($verbose > 2); local $/ = undef; # read entire file my $body = <$in>; close $in; @@ -228,6 +234,21 @@ sub set_icon($) { } +sub set_thumb($) { + my ($app_dir) = @_; + + return unless ($app_dir =~ m@\.saver/?$@s); + + my @cmd = ("$exec_dir/update-thumbnail.pl", $thumbdir, $app_dir); + push @cmd, "-" . ("v" x $verbose) if ($verbose); + print STDERR "$progname: exec: " . join(' ', @cmd) . "\n" + if ($verbose > 1); + system (@cmd); + my $exit = $? >> 8; + exit ($exit) if $exit; +} + + sub update($) { my ($app_dir) = @_; @@ -282,6 +303,7 @@ sub update($) { } set_icon ($app_dir); + set_thumb ($app_dir); }