summaryrefslogtreecommitdiffstats
path: root/wps
diff options
context:
space:
mode:
authorThomas Martitz <kugel@rockbox.org>2010-08-01 16:15:27 +0000
committerThomas Martitz <kugel@rockbox.org>2010-08-01 16:15:27 +0000
commit9c0b2479f7025a84444adf08e3be8ced60dad013 (patch)
treef3d328dd73f46d599f0432cc43ae206798cbe4f6 /wps
parent2e7d92fef707a2cd30820fd0053c539c3ac8e2b3 (diff)
downloadrockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.tar.gz
rockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.tar.bz2
rockbox-9c0b2479f7025a84444adf08e3be8ced60dad013.zip
Rockbox as an application: add get_user_file_path().
For RaaA it evaluates user paths at runtime. For everything but codecs/plugins it will give the path under $HOME/.config/rockbox.org if write access is needed or if the file/folder in question exists there (otherwise it gives /usr/local/share/rockbox). This allows for installing themes under $HOME as well as having config.cfg and other important files there while installing the application (and default themes) under /usr/local. On the DAPs it's a no-op, returing /.rockbox directly. Not converted to use get_user_file_path() are plugins themselves, because RaaA doesn't build plugins yet. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@27656 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'wps')
-rw-r--r--wps/WPSLIST44
-rwxr-xr-xwps/wpsbuild.pl69
2 files changed, 61 insertions, 52 deletions
diff --git a/wps/WPSLIST b/wps/WPSLIST
index 13cb263865..3068f48513 100644
--- a/wps/WPSLIST
+++ b/wps/WPSLIST
@@ -346,30 +346,30 @@ selector type.160x128x2: bar (inverse)
selector type.138x110x2: bar (inverse)
#icons
-iconset.320x240x16: /.rockbox/icons/tango_small.bmp
-iconset.128x128x16: /.rockbox/icons/tango_small.bmp
-iconset.132x80x16: /.rockbox/icons/tango_small.bmp
-iconset.138x110x2: /.rockbox/icons/tango_small_mono.bmp
-iconset.160x128x16: /.rockbox/icons/tango_small.bmp
-iconset.160x128x2: /.rockbox/icons/tango_small_mono.bmp
-iconset.176x132x16: /.rockbox/icons/tango_small.bmp
-iconset.176x220x16: /.rockbox/icons/tango_small.bmp
-iconset.220x176x16: /.rockbox/icons/tango_small.bmp
-iconset.240x320x16: /.rockbox/icons/tango_small.bmp
-iconset.240x400x16: /.rockbox/icons/tango_small.bmp
+iconset.320x240x16: icons/tango_small.bmp
+iconset.128x128x16: icons/tango_small.bmp
+iconset.132x80x16: icons/tango_small.bmp
+iconset.138x110x2: icons/tango_small_mono.bmp
+iconset.160x128x16: icons/tango_small.bmp
+iconset.160x128x2: icons/tango_small_mono.bmp
+iconset.176x132x16: icons/tango_small.bmp
+iconset.176x220x16: icons/tango_small.bmp
+iconset.220x176x16: icons/tango_small.bmp
+iconset.240x320x16: icons/tango_small.bmp
+iconset.240x400x16: icons/tango_small.bmp
#viewer icons
-viewers iconset.320x240x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.128x128x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.132x80x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.138x110x2: /.rockbox/icons/tango_small_viewers_mono.bmp
-viewers iconset.160x128x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.160x128x2: /.rockbox/icons/tango_small_viewers_mono.bmp
-viewers iconset.176x132x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.176x220x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.220x176x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.240x320x16: /.rockbox/icons/tango_small_viewers.bmp
-viewers iconset.240x400x16: /.rockbox/icons/tango_small_viewers.bmp
+viewers iconset.320x240x16: icons/tango_small_viewers.bmp
+viewers iconset.128x128x16: icons/tango_small_viewers.bmp
+viewers iconset.132x80x16: icons/tango_small_viewers.bmp
+viewers iconset.138x110x2: icons/tango_small_viewers_mono.bmp
+viewers iconset.160x128x16: icons/tango_small_viewers.bmp
+viewers iconset.160x128x2: icons/tango_small_viewers_mono.bmp
+viewers iconset.176x132x16: icons/tango_small_viewers.bmp
+viewers iconset.176x220x16: icons/tango_small_viewers.bmp
+viewers iconset.220x176x16: icons/tango_small_viewers.bmp
+viewers iconset.240x320x16: icons/tango_small_viewers.bmp
+viewers iconset.240x400x16: icons/tango_small_viewers.bmp
# Whether the WPS is designed to have the statusbar on or off
Statusbar: top
diff --git a/wps/wpsbuild.pl b/wps/wpsbuild.pl
index f07ad6dc01..7e54f109cb 100755
--- a/wps/wpsbuild.pl
+++ b/wps/wpsbuild.pl
@@ -14,6 +14,7 @@ use Getopt::Long qw(:config pass_through); # pass_through so not confused by -DT
my $ROOT="..";
my $verbose;
my $rbdir=".rockbox";
+my $tempdir=".rockbox";
my $wpslist;
my $target;
my $modelname;
@@ -23,6 +24,7 @@ GetOptions ( 'r|root=s' => \$ROOT,
'm|modelname=s' => \$modelname,
'v|verbose' => \$verbose,
'rbdir=s' => \$rbdir, # If we want to put in a different directory
+ 'tempdir=s' => \$tempdir, # override .rockbox temporary dir
);
($wpslist, $target) = @ARGV;
@@ -72,7 +74,7 @@ my $has_remote;
if(!$wpslist) {
print "Usage: wpsbuilds.pl <WPSLIST> <target>\n",
"Run this script in the root of the target build, and it will put all the\n",
- "stuff in $rbdir/wps/\n";
+ "stuff in $tempdir/wps/\n and build the cfg according to $rbdir";
exit;
}
@@ -135,15 +137,15 @@ sub mkdirs
{
my $wpsdir = $wps;
$wpsdir =~ s/\.(r|)wps//;
- mkdir "$rbdir/wps", 0777;
- mkdir "$rbdir/themes", 0777;
+ mkdir "$tempdir/wps", 0777;
+ mkdir "$tempdir/themes", 0777;
- if( -d "$rbdir/wps/$wpsdir") {
+ if( -d "$tempdir/wps/$wpsdir") {
#print STDERR "wpsbuild warning: directory wps/$wpsdir already exists!\n";
}
else
{
- mkdir "$rbdir/wps/$wpsdir", 0777;
+ mkdir "$tempdir/wps/$wpsdir", 0777;
}
}
@@ -153,7 +155,7 @@ sub copybackdrop
if ($backdrop ne '') {
my $dst = $backdrop;
$dst =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
- my $cmd = "cp $ROOT/$backdrop $rbdir/$dst";
+ my $cmd = "cp $ROOT/$backdrop $tempdir/$dst";
`$cmd`;
}
}
@@ -164,19 +166,19 @@ sub copythemefont
my $o = $_[0];
$o =~ s/\.fnt/\.bdf/;
- mkdir "$rbdir/fonts";
- my $cmd ="$ROOT/tools/convbdf -f -o \"$rbdir/fonts/$_[0]\" \"$ROOT/fonts/$o\" ";
+ mkdir "$tempdir/fonts";
+ my $cmd ="$ROOT/tools/convbdf -f -o \"$tempdir/fonts/$_[0]\" \"$ROOT/fonts/$o\" ";
`$cmd`;
}
sub copythemeicon
{
#copy the icon specified by the theme
-
if ($iconset ne '') {
- $iconset =~ s/.rockbox/$rbdir/;
- $iconset =~ /\/(.*icons\/(.*))/i;
- `cp $ROOT/icons/$2 $1`;
+ my $tempicon = $tempdir . "/" . $iconset;
+ $iconset = $rbdir . "/" . $iconset;
+ $tempicon =~ /\/.*icons\/(.*)/i;
+ `cp $ROOT/icons/$1 $tempicon`;
}
}
@@ -185,9 +187,10 @@ sub copythemeviewericon
#copy the viewer icon specified by the theme
if ($viewericon ne '') {
- $viewericon =~ s/.rockbox/$rbdir/;
- $viewericon =~ /\/(.*icons\/(.*))/i;
- `cp $ROOT/icons/$2 $1`;
+ my $tempviewericon = $tempdir . "/" . $viewericon;
+ $viewericon = $rbdir . "/" . $viewericon;
+ $tempviewericon =~ /\/.*icons\/(.*)/i;
+ `cp $ROOT/icons/$1 $tempviewericon`;
}
}
@@ -209,20 +212,20 @@ sub copywps
# system("cp $dir/$wps .rockbox/wps/");
# check for <name>.WIDTHxHEIGHTxDEPTH.sbs
if (-e "$dir/$__sb") {
- system("cp $dir/$__sb $rbdir/wps/$sbs");
+ system("cp $dir/$__sb $tempdir/wps/$sbs");
}
# check for <name>.WIDTHxHEIGHTxDEPTH.<model>.sbs and overwrite the
# previous sb if needed
$__sb = $sbs_prefix . "." . $req_size . "." . $modelname . ".sbs";
if (-e "$dir/$__sb") {
- system("cp $dir/$__sb $rbdir/wps/$sbs");
+ system("cp $dir/$__sb $tempdir/wps/$sbs");
}
if (-e "$dir/$req_t_wps" ) {
- system("cp $dir/$req_t_wps $rbdir/wps/$wps");
+ system("cp $dir/$req_t_wps $tempdir/wps/$wps");
} elsif (-e "$dir/$req_g_wps") {
- system("cp $dir/$req_g_wps $rbdir/wps/$wps");
+ system("cp $dir/$req_g_wps $tempdir/wps/$wps");
open(WPSFILE, "$dir/$req_g_wps");
while (<WPSFILE>) {
@@ -233,12 +236,12 @@ sub copywps
if ($#filelist >= 0) {
if (-e "$dir/$wps_prefix/$req_size") {
foreach $file (@filelist) {
- system("cp $dir/$wps_prefix/$req_size/$file $rbdir/wps/$wps_prefix/");
+ system("cp $dir/$wps_prefix/$req_size/$file $tempdir/wps/$wps_prefix/");
}
}
elsif (-e "$dir/$wps_prefix") {
foreach $file (@filelist) {
- system("cp $dir/$wps_prefix/$file $rbdir/wps/$wps_prefix/");
+ system("cp $dir/$wps_prefix/$file $tempdir/wps/$wps_prefix/");
}
}
else {
@@ -265,35 +268,35 @@ sub buildcfg {
\# $cfg generated by wpsbuild.pl
\# $wps is made by $author
\#
-wps: /$rbdir/wps/$wps
+wps: $rbdir/wps/$wps
MOO
;
if(defined($sbs)) {
if ($sbs eq '') {
push @out, "sbs: -\n";
} else {
- push @out, "sbs: /$rbdir/wps/$sbs\n";
+ push @out, "sbs: $rbdir/wps/$sbs\n";
}
}
if(defined($rsbs) && $has_remote) {
if ($rsbs eq '') {
push @out, "rsbs: -\n";
} else {
- push @out, "rsbs: /$rbdir/wps/$rsbs\n";
+ push @out, "rsbs: $rbdir/wps/$rsbs\n";
}
}
if($font) {
if ($font eq '') {
push @out, "font: -\n";
} else {
- push @out, "font: /$rbdir/fonts/$font\n";
+ push @out, "font: $rbdir/fonts/$font\n";
}
}
if(defined($remotefont) && $has_remote) {
if ($remotefont eq '') {
push @out, "remote font: -\n";
} else {
- push @out, "remote font: /$rbdir/fonts/$remotefont\n";
+ push @out, "remote font: $rbdir/fonts/$remotefont\n";
}
}
if($fgcolor && $main_depth > 2) {
@@ -314,7 +317,7 @@ MOO
} else {
# clip resolution from filename
$backdrop =~ s/(\.[0-9]*x[0-9]*x[0-9]*)//;
- push @out, "backdrop: /$rbdir/$backdrop\n";
+ push @out, "backdrop: $rbdir/$backdrop\n";
}
}
if($lineselectstart && $main_depth > 2) {
@@ -354,7 +357,7 @@ MOO
if ($rwps eq '') {
push @out, "rwps: -\n";
} else {
- push @out, "rwps: /$rbdir/wps/$rwps\n";
+ push @out, "rwps: $rbdir/wps/$rwps\n";
}
}
if(defined($listviewport)) {
@@ -371,11 +374,11 @@ MOO
push @out, "remote ui viewport: $listviewport\n";
}
}
- if(-f "$rbdir/wps/$cfg") {
+ if(-f "$tempdir/wps/$cfg") {
print STDERR "wpsbuild warning: wps/$cfg already exists!\n";
}
else {
- open(CFG, ">$rbdir/themes/$cfg");
+ open(CFG, ">$tempdir/themes/$cfg");
print CFG @out;
close(CFG);
}
@@ -401,6 +404,12 @@ while(<WPS>) {
# skip comment
next;
}
+
+ # prefix $rbdir with / if needed (needed for the theme.cfg)
+ unless ($rbdir =~ /\/.*/) {
+ $rbdir = "/" . $rbdir;
+ }
+
if($l =~ /^ *<(r|)wps>/i) {
$isrwps = $1;
$within = 1;