[game-data-packager] 08/11: Launcher: look for .desktop files in our directory, then XDG_DATA_DIRS

Simon McVittie smcv at debian.org
Fri Oct 14 00:13:42 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch master
in repository game-data-packager.

commit af8ee75c9ad5744a5bf799471413573139b3144a
Author: Simon McVittie <smcv at debian.org>
Date:   Fri Oct 14 00:45:59 2016 +0100

    Launcher: look for .desktop files in our directory, then XDG_DATA_DIRS
    
    This means we don't need to install quake*.desktop and etqw.desktop
    twice, and we can launch Quake-series expansions.
---
 Makefile            |  5 ++++-
 runtime/launcher.py | 10 +++++++---
 2 files changed, 11 insertions(+), 4 deletions(-)

diff --git a/Makefile b/Makefile
index f878df5..8f8810f 100644
--- a/Makefile
+++ b/Makefile
@@ -30,7 +30,10 @@ dot_in    := $(patsubst ./data/%,./out/%,$(wildcard ./data/*.in))
 desktop   := $(patsubst ./runtime/%.in,./out/%,$(wildcard ./runtime/*.desktop.in))
 
 launcher_json := $(patsubst ./runtime/launch-%.yaml.in,./out/launch-%.json,$(wildcard ./runtime/launch-*.yaml.in))
-launcher_desktops := $(patsubst ./runtime/launch-%.yaml.in,./out/%.desktop,$(wildcard ./runtime/launch-*.yaml.in))
+launcher_desktops := \
+	out/unreal.desktop \
+	out/unreal-gold.desktop \
+	$(NULL)
 
 quake_layer_sizes = 16 22 32 48 256
 
diff --git a/runtime/launcher.py b/runtime/launcher.py
index 5ac9c8d..e0f695e 100755
--- a/runtime/launcher.py
+++ b/runtime/launcher.py
@@ -196,9 +196,13 @@ class Launcher:
 
         self.id = self.args.id
         self.keyfile = GLib.KeyFile()
-        self.keyfile.load_from_file(os.path.join(RUNTIME_BUILT,
-                    self.id + '.desktop'),
-                GLib.KeyFileFlags.NONE)
+        desktop = os.path.join(RUNTIME_BUILT, self.id + '.desktop')
+        if os.path.exists(desktop):
+            self.keyfile.load_from_file(desktop, GLib.KeyFileFlags.NONE)
+        else:
+            self.keyfile.load_from_data_dirs(
+                    'applications/%s.desktop' % self.id,
+                    GLib.KeyFileFlags.NONE)
 
         self.name = self.keyfile.get_string(GLib.KEY_FILE_DESKTOP_GROUP,
             GLib.KEY_FILE_DESKTOP_KEY_NAME)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list