From af48260399151e575bc40c7a648e3a2e0037e04e Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 5 Oct 2005 08:02:10 +0000 Subject: Modified the viewers.config syntax slightly. The name field should now include path of the plugin/viewer on target, but exclude the exension. Now the Sudoku plugin acts as a normal plugin and a viewer at the same time. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7582 a1c6a512-1295-4272-9138-f99709370657 --- tools/buildzip.pl | 36 ++++++++++++++++++++++++++---------- 1 file changed, 26 insertions(+), 10 deletions(-) (limited to 'tools') diff --git a/tools/buildzip.pl b/tools/buildzip.pl index b5e4435545..3d6a42137c 100755 --- a/tools/buildzip.pl +++ b/tools/buildzip.pl @@ -76,23 +76,39 @@ sub buildzip { open VIEWERS, ">.rockbox/viewers.config" or die "can't create .rockbox/viewers.config"; mkdir ".rockbox/viewers", 0777; - for (@viewers) { - if (/,(.+).rock,/) { - my $r = "$1.rock"; - my $o = "$1.ovl"; - if(-e ".rockbox/rocks/$r") { - `mv .rockbox/rocks/$r .rockbox/viewers`; - print VIEWERS $_; + foreach my $line (@viewers) { + if ($line =~ /([^,]*),([^,]*),/) { + my ($ext, $plugin)=($1, $2); + my $r = "${plugin}.rock"; + my $o = "${plugin}.ovl"; + + my $dir = $r; + my $name; + + # strip off the last slash and file name part + $dir =~ s/(.*)\/(.*)/$1/; + # store the file name part + $name = $2; + + # print STDERR "$ext $plugin $dir $name $r\n"; + + if(-e ".rockbox/rocks/$name") { + if($dir ne "rocks") { + # target is not 'rocks' but the plugins are always in that + # dir at first! + `mv .rockbox/rocks/$name .rockbox/$r`; + } + print VIEWERS $line; } - elsif(-e ".rockbox/viewers/$r") { + elsif(-e ".rockbox/$r") { # in case the same plugin works for multiple extensions, it # was already moved to the viewers dir - print VIEWERS $_; + print VIEWERS $line; } if(-e ".rockbox/rocks/$o") { # if there's an "overlay" file for the .rock, move that as # well - `mv .rockbox/rocks/$o .rockbox/viewers`; + `mv .rockbox/rocks/$o .rockbox/$o`; } } } -- cgit v1.2.3