File xdg-mime-return-existing-desktop-files.patch of Package xdg-utils

commit 88deef3f4affa53680382540c2cd1ba9ce8e082d
Author: Simon Lees <sflees@suse.de>
Date:   Fri Jun 3 16:45:08 2016 +0930

    xdg-mime only return desktop file for existing apps
    
    xdg-mime originally returned whatever was in the mimeapps.list
    file, now it only returns the first desktop file that exists
    and has a corrosponding binary that exists.
    
    fdo#44163

Index: xdg-utils-20160520/scripts/xdg-mime.in
===================================================================
--- xdg-utils-20160520.orig/scripts/xdg-mime.in
+++ xdg-utils-20160520/scripts/xdg-mime.in
@@ -372,8 +372,17 @@ check_mimeapps_list()
     }
 ' "$mimeapps_list" | cut -d ';' -f 1)
             if [ -n "$result" ]; then
-                echo "$result"
-                exit_success
+                # $result could be a ; separated list of .desktop files
+                # use the first on the system
+                IFS=\;
+                for app in $result; do
+                    IFS="$oldifs"
+                    exists=$(desktop_file_to_binary "$app")
+                    if [ -n "$exists" ]; then
+                        echo "$app"
+                        exit_success
+                    fi
+                done
             fi
         fi
     done
openSUSE Build Service is sponsored by