chiark / gitweb /
desktop.pl: cope with unfinished puzzles.
authorSimon Tatham <anakin@pobox.com>
Mon, 29 Mar 2021 20:32:42 +0000 (21:32 +0100)
committerSimon Tatham <anakin@pobox.com>
Mon, 29 Mar 2021 20:32:42 +0000 (21:32 +0100)
If I built with an unfinished puzzle enabled, then it will end up in
the 'unfinished' subdir of the main build directory, so desktop.pl
will need to write out a reference to it there.

desktop.pl

index 204c0ce262ea13b19012e29d718094061e73f395..042bf9043569653301cb717bfa3997f33e87c28a 100755 (executable)
@@ -36,12 +36,16 @@ while (<$desc>) {
     open my $desktop, ">", "$outdir/$id.desktop"
         or die "$outdir/$id.desktop: open: $!\n";
 
+    my $path = "$bindir/$id";
+    my $upath = "$bindir/unfinished/$id";
+    $path = $upath if ! -f $path && -f $upath;
+
     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 "Exec=$path\n";
     print $desktop "Icon=$icondir/$id-48d24.png\n";
     print $desktop "StartupNotify=false\n";
     print $desktop "Categories=Game;\n";