1
0
Fork 0
forked from len0rd/rockbox

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
This commit is contained in:
Daniel Stenberg 2005-10-05 08:02:10 +00:00
parent 8dd2ff50c6
commit af48260399
3 changed files with 47 additions and 28 deletions

View file

@ -188,7 +188,7 @@ char* filetype_get_plugin(const struct entry* file)
return NULL;
snprintf(plugin_name, sizeof(plugin_name),
VIEWERS_DIR "/%s.rock",filetypes[ix].plugin);
"%s/%s.rock", ROCKBOX_DIR, filetypes[ix].plugin);
return plugin_name;
}
@ -453,9 +453,13 @@ static int add_plugin(char *plugin)
if (!plugin)
return 0;
#if 0
/* starting now, Oct 2005, the plugins are given without extension in the
viewers.config file */
cp=strrchr(plugin, '.');
if (cp)
*cp='\0';
#endif
for (i=first_soft_filetype; i < cnt_filetypes; i++)
{

View file

@ -1,17 +1,16 @@
ch8,chip8.rock,70 70 7f 7f 70 70
txt,viewer.rock,55 55 55 55 55 55
nfo,viewer.rock,55 55 55 55 55 55
jpg,jpeg.rock,18 24 3C 3C 24 18
ucl,rockbox_flash.rock,2A 7F 41 41 7F 2A
rvf,video.rock,5D 7F 5D 7F 5D 7F
mp3,vbrfix.rock,10 08 58 38 04 02
m3u,search.rock,00 00 00 00 00 00
txt,sort.rock, 00 00 00 00 00 00
gb,rockboy.rock, 0C 2A 59 7A 2E 0C
gbc,rockboy.rock, 0C 2A 59 7A 2E 0C
m3u,iriverify.rock,00 00 00 00 00 00
mid,midi2wav.rock, 20 70 70 3F 00 00
rsp,searchengine.rock, 0e 11 11 31 7e 60
ss,sudoku.rock, 55 55 55 55 55 55
wav,wav2wv.rock, 00 00 00 00 00 00
ch8,viewers/chip8,70 70 7f 7f 70 70
txt,viewers/viewer,55 55 55 55 55 55
nfo,viewers/viewer,55 55 55 55 55 55
jpg,viewers/jpeg,18 24 3C 3C 24 18
ucl,viewers/rockbox_flash,2A 7F 41 41 7F 2A
rvf,viewers/video,5D 7F 5D 7F 5D 7F
mp3,viewers/vbrfix,10 08 58 38 04 02
m3u,viewers/search,00 00 00 00 00 00
txt,viewers/sort, 00 00 00 00 00 00
gb,viewers/rockboy, 0C 2A 59 7A 2E 0C
gbc,viewers/rockboy, 0C 2A 59 7A 2E 0C
m3u,viewers/iriverify,00 00 00 00 00 00
mid,viewers/midi2wav, 20 70 70 3F 00 00
rsp,viewers/searchengine, 0e 11 11 31 7e 60
ss,rocks/sudoku, 55 55 55 55 55 55
wav,viewers/wav2wv, 00 00 00 00 00 00

View file

@ -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`;
}
}
}