summaryrefslogtreecommitdiff
path: root/apps/plugins/puzzles/src/desktop.pl
diff options
context:
space:
mode:
authorFranklin Wei <git@fwei.tk>2017-04-29 18:21:56 -0400
committerFranklin Wei <git@fwei.tk>2017-04-29 18:24:42 -0400
commit881746789a489fad85aae8317555f73dbe261556 (patch)
treecec2946362c4698c8db3c10f3242ef546c2c22dd /apps/plugins/puzzles/src/desktop.pl
parent03dd4b92be7dcd5c8ab06da3810887060e06abd5 (diff)
downloadrockbox-881746789a489fad85aae8317555f73dbe261556.tar.gz
rockbox-881746789a489fad85aae8317555f73dbe261556.zip
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-xapps/plugins/puzzles/src/desktop.pl52
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 0000000000..204c0ce262
--- /dev/null
+++ b/apps/plugins/puzzles/src/desktop.pl
@@ -0,0 +1,52 @@
1#!/usr/bin/perl
2
3# Make .desktop files for the puzzles.
4#
5# At present, this script is intended for developer usage: if you're
6# working on the puzzles and want to play your bleeding-edge locally
7# modified and compiled versions, run this script and it will create a
8# collection of desktop files in ~/.local/share/applications where
9# XFCE can pick them up and add them to its main menu. (Be sure to run
10# 'xfdesktop --reload' after running this.)
11#
12# (If you don't use XFCE, patches to support other desktop
13# environments are welcome :-)
14
15use strict;
16use warnings;
17use Cwd 'abs_path';
18
19die "usage: desktop.pl [<outdir> [<bindir> <icondir>]]\n"
20 unless @ARGV == 0 or @ARGV == 1 or @ARGV == 3;
21
22my ($outdir, $bindir, $icondir) = @ARGV;
23$outdir = $ENV{'HOME'}."/.local/share/applications" unless defined $outdir;
24$bindir = "." unless defined $bindir;
25$icondir = "./icons" unless defined $icondir;
26$bindir = abs_path($bindir);
27$icondir = abs_path($icondir);
28
29open my $desc, "<", "gamedesc.txt"
30 or die "gamedesc.txt: open: $!\n";
31
32while (<$desc>) {
33 chomp;
34 my ($id, $win, $displayname, $description, $summary) = split /:/, $_;
35
36 open my $desktop, ">", "$outdir/$id.desktop"
37 or die "$outdir/$id.desktop: open: $!\n";
38
39 print $desktop "[Desktop Entry]\n";
40 print $desktop "Version=1.0\n";
41 print $desktop "Type=Application\n";
42 print $desktop "Name=$displayname\n";
43 print $desktop "Comment=$description\n";
44 print $desktop "Exec=$bindir/$id\n";
45 print $desktop "Icon=$icondir/$id-48d24.png\n";
46 print $desktop "StartupNotify=false\n";
47 print $desktop "Categories=Game;\n";
48 print $desktop "Terminal=false\n";
49
50 close $desktop
51 or die "$outdir/$id.desktop: close: $!\n";
52}