diff options
| author | Franklin Wei <git@fwei.tk> | 2017-04-29 18:21:56 -0400 |
|---|---|---|
| committer | Franklin Wei <git@fwei.tk> | 2017-04-29 18:24:42 -0400 |
| commit | 881746789a489fad85aae8317555f73dbe261556 (patch) | |
| tree | cec2946362c4698c8db3c10f3242ef546c2c22dd /apps/plugins/puzzles/src/desktop.pl | |
| parent | 03dd4b92be7dcd5c8ab06da3810887060e06abd5 (diff) | |
| download | rockbox-881746789a489fad85aae8317555f73dbe261556.zip rockbox-881746789a489fad85aae8317555f73dbe261556.tar.gz rockbox-881746789a489fad85aae8317555f73dbe261556.tar.bz2 rockbox-881746789a489fad85aae8317555f73dbe261556.tar.xz | |
puzzles: refactor and resync with upstream
This brings puzzles up-to-date with upstream revision
2d333750272c3967cfd5cd3677572cddeaad5932, though certain changes made
by me, including cursor-only Untangle and some compilation fixes
remain. Upstream code has been moved to its separate subdirectory and
future syncs can be done by simply copying over the new sources.
Change-Id: Ia6506ca5f78c3627165ea6791d38db414ace0804
Diffstat (limited to 'apps/plugins/puzzles/src/desktop.pl')
| -rwxr-xr-x | apps/plugins/puzzles/src/desktop.pl | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/apps/plugins/puzzles/src/desktop.pl b/apps/plugins/puzzles/src/desktop.pl new file mode 100755 index 0000000..204c0ce --- /dev/null +++ b/apps/plugins/puzzles/src/desktop.pl @@ -0,0 +1,52 @@ +#!/usr/bin/perl + +# Make .desktop files for the puzzles. +# +# At present, this script is intended for developer usage: if you're +# working on the puzzles and want to play your bleeding-edge locally +# modified and compiled versions, run this script and it will create a +# collection of desktop files in ~/.local/share/applications where +# XFCE can pick them up and add them to its main menu. (Be sure to run +# 'xfdesktop --reload' after running this.) +# +# (If you don't use XFCE, patches to support other desktop +# environments are welcome :-) + +use strict; +use warnings; +use Cwd 'abs_path'; + +die "usage: desktop.pl [<outdir> [<bindir> <icondir>]]\n" + unless @ARGV == 0 or @ARGV == 1 or @ARGV == 3; + +my ($outdir, $bindir, $icondir) = @ARGV; +$outdir = $ENV{'HOME'}."/.local/share/applications" unless defined $outdir; +$bindir = "." unless defined $bindir; +$icondir = "./icons" unless defined $icondir; +$bindir = abs_path($bindir); +$icondir = abs_path($icondir); + +open my $desc, "<", "gamedesc.txt" + or die "gamedesc.txt: open: $!\n"; + +while (<$desc>) { + chomp; + my ($id, $win, $displayname, $description, $summary) = split /:/, $_; + + open my $desktop, ">", "$outdir/$id.desktop" + or die "$outdir/$id.desktop: open: $!\n"; + + print $desktop "[Desktop Entry]\n"; + print $desktop "Version=1.0\n"; + print $desktop "Type=Application\n"; + print $desktop "Name=$displayname\n"; + print $desktop "Comment=$description\n"; + print $desktop "Exec=$bindir/$id\n"; + print $desktop "Icon=$icondir/$id-48d24.png\n"; + print $desktop "StartupNotify=false\n"; + print $desktop "Categories=Game;\n"; + print $desktop "Terminal=false\n"; + + close $desktop + or die "$outdir/$id.desktop: close: $!\n"; +} |