summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Hughes <richard@hughsie.com>2018-05-02 12:24:18 +0100
committerRichard Hughes <richard@hughsie.com>2018-05-02 12:24:18 +0100
commit2f2e2ee3d39955bc26fac9781f491d4f426ede18 (patch)
tree859cb3e23d27bc8796abb727973b50e6cdb5ddf9
parent0f9a78d8dc53cb7b918c4543c957d243bcd67c85 (diff)
downloadappstream-glib-2f2e2ee3d39955bc26fac9781f491d4f426ede18.tar.gz
Use the launchable to find the desktop filename when using appstream-builder
-rw-r--r--libappstream-builder/plugins/asb-plugin-desktop.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/libappstream-builder/plugins/asb-plugin-desktop.c b/libappstream-builder/plugins/asb-plugin-desktop.c
index 0249966..a4662e9 100644
--- a/libappstream-builder/plugins/asb-plugin-desktop.c
+++ b/libappstream-builder/plugins/asb-plugin-desktop.c
@@ -246,19 +246,31 @@ asb_plugin_process_app (AsbPlugin *plugin,
const gchar *tmpdir,
GError **error)
{
+ AsLaunchable *launchable;
gboolean found = FALSE;
guint i;
+ g_autoptr(GString) desktop_basename = NULL;
const gchar *app_dirs[] = {
"/usr/share/applications",
"/usr/share/applications/kde4",
NULL };
+ /* get the (optional) launchable to get the name of the desktop file */
+ launchable = as_app_get_launchable_by_kind (AS_APP (app), AS_LAUNCHABLE_KIND_DESKTOP_ID);
+ if (launchable != NULL) {
+ desktop_basename = g_string_new (as_launchable_get_value (launchable));
+ } else {
+ desktop_basename = g_string_new (as_app_get_id (AS_APP (app)));
+ if (!g_str_has_suffix (desktop_basename->str, ".desktop"))
+ g_string_append (desktop_basename, ".desktop");
+ }
+
/* use the .desktop file to refine the application */
for (i = 0; app_dirs[i] != NULL; i++) {
g_autofree gchar *fn = NULL;
fn = g_build_filename (tmpdir,
app_dirs[i],
- as_app_get_id (AS_APP (app)),
+ desktop_basename->str,
NULL);
if (g_file_test (fn, G_FILE_TEST_EXISTS)) {
if (!asb_plugin_desktop_refine (plugin, pkg, fn,