[gnome-software] datadir-apps: fix desktop files with multiple dots



commit 13fbf159961bf4c60435d0d362fe164c329a4e03
Author: Giovanni Campagna <gcampagna src gnome org>
Date:   Sat Aug 31 16:00:02 2013 +0200

    datadir-apps: fix desktop files with multiple dots
    
    We must only remove the last .desktop, otherwise app IDs in
    reverse DNS notation get stripped to the first component.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=707185

 src/plugins/gs-plugin-datadir-apps.c |    6 +++++-
 1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/src/plugins/gs-plugin-datadir-apps.c b/src/plugins/gs-plugin-datadir-apps.c
index 9cfd5b8..23a1aef 100644
--- a/src/plugins/gs-plugin-datadir-apps.c
+++ b/src/plugins/gs-plugin-datadir-apps.c
@@ -21,6 +21,7 @@
 
 #include <config.h>
 
+#include <string.h>
 #include <gs-plugin.h>
 
 struct GsPluginPrivate {
@@ -123,6 +124,7 @@ gs_plugin_datadir_apps_extract_desktop_data (GsPlugin *plugin,
        gchar *comment = NULL;
        gchar *name = NULL;
        gchar *icon = NULL;
+       gchar *dot;
        GKeyFile *key_file = NULL;
        GdkPixbuf *pixbuf = NULL;
        GsPluginDataDirAppsCacheItem *cache_item;
@@ -189,7 +191,9 @@ gs_plugin_datadir_apps_extract_desktop_data (GsPlugin *plugin,
 
        /* set new id */
        basename = g_path_get_basename (desktop_file);
-       g_strdelimit (basename, ".", '\0');
+       dot = strrchr (basename, '.');
+       if (dot)
+               *dot = '\0';
        basename_tmp = basename;
        if (g_str_has_prefix (basename_tmp, "fedora-"))
                basename_tmp += 7;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]