summaryrefslogtreecommitdiff
path: root/tools/buildzip.pl
diff options
context:
space:
mode:
Diffstat (limited to 'tools/buildzip.pl')
-rwxr-xr-xtools/buildzip.pl36
1 files changed, 26 insertions, 10 deletions
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 {
76 open VIEWERS, ">.rockbox/viewers.config" or 76 open VIEWERS, ">.rockbox/viewers.config" or
77 die "can't create .rockbox/viewers.config"; 77 die "can't create .rockbox/viewers.config";
78 mkdir ".rockbox/viewers", 0777; 78 mkdir ".rockbox/viewers", 0777;
79 for (@viewers) { 79 foreach my $line (@viewers) {
80 if (/,(.+).rock,/) { 80 if ($line =~ /([^,]*),([^,]*),/) {
81 my $r = "$1.rock"; 81 my ($ext, $plugin)=($1, $2);
82 my $o = "$1.ovl"; 82 my $r = "${plugin}.rock";
83 if(-e ".rockbox/rocks/$r") { 83 my $o = "${plugin}.ovl";
84 `mv .rockbox/rocks/$r .rockbox/viewers`; 84
85 print VIEWERS $_; 85 my $dir = $r;
86 my $name;
87
88 # strip off the last slash and file name part
89 $dir =~ s/(.*)\/(.*)/$1/;
90 # store the file name part
91 $name = $2;
92
93 # print STDERR "$ext $plugin $dir $name $r\n";
94
95 if(-e ".rockbox/rocks/$name") {
96 if($dir ne "rocks") {
97 # target is not 'rocks' but the plugins are always in that
98 # dir at first!
99 `mv .rockbox/rocks/$name .rockbox/$r`;
100 }
101 print VIEWERS $line;
86 } 102 }
87 elsif(-e ".rockbox/viewers/$r") { 103 elsif(-e ".rockbox/$r") {
88 # in case the same plugin works for multiple extensions, it 104 # in case the same plugin works for multiple extensions, it
89 # was already moved to the viewers dir 105 # was already moved to the viewers dir
90 print VIEWERS $_; 106 print VIEWERS $line;
91 } 107 }
92 if(-e ".rockbox/rocks/$o") { 108 if(-e ".rockbox/rocks/$o") {
93 # if there's an "overlay" file for the .rock, move that as 109 # if there's an "overlay" file for the .rock, move that as
94 # well 110 # well
95 `mv .rockbox/rocks/$o .rockbox/viewers`; 111 `mv .rockbox/rocks/$o .rockbox/$o`;
96 } 112 }
97 } 113 }
98 } 114 }