Bug 25563

Summary: xdg-mime default displays error when kde is not on the machine
Product: Portland Reporter: Pascal Terjan <pterjan>
Component: xdg-utilsAssignee: Portland Bugs <portland-bugs>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium CC: rdieter
Version: unspecified   
Hardware: Other   
OS: All   
Whiteboard:
i915 platform: i915 features:

Description Pascal Terjan 2009-12-10 06:29:50 UTC
code in make_default_kde contains:

    if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
        default_dir=`kde4-config --path xdgdata-apps | cut -d ':' -f 1`
        default_file="$default_dir/mimeapps.list"
    else
        default_dir=`kde-config --path config | cut -d ':' -f 1`
        default_file="$default_dir/profilerc"
    fi

so it will give an error if kde-config is not available
Comment 1 Rex Dieter 2009-12-17 10:56:00 UTC
I'll take a look to see if we can make it fail a little more gracefully.
Comment 2 Rex Dieter 2009-12-17 11:07:49 UTC
Fixed in cvs.

Index: xdg-mime.in                                                                                          
===================================================================                                         
RCS file: /cvs/portland/portland/xdg-utils/scripts/xdg-mime.in,v                                            
retrieving revision 1.46                                                                                    
diff -u -3 -p -r1.46 xdg-mime.in                                                                            
--- xdg-mime.in 31 Jul 2009 06:42:46 -0000      1.46                                                        
+++ xdg-mime.in 17 Dec 2009 19:06:35 -0000                                                                  
@@ -106,12 +106,16 @@ make_default_kde()
     vendor="$1"
     mimetype="$2"
     if [ x"$KDE_SESSION_VERSION" = x"4" ]; then
-        default_dir=`kde4-config --path xdgdata-apps | cut -d ':' -f 1`
+        default_dir=`kde4-config --path xdgdata-apps 2> /dev/null | cut -d ':' -f 1`
         default_file="$default_dir/mimeapps.list"
     else
-        default_dir=`kde-config --path config | cut -d ':' -f 1`
+        default_dir=`kde-config --path config 2> /dev/null | cut -d ':' -f 1`
         default_file="$default_dir/profilerc"
     fi
+    if [ -z "$default_dir" ]; then
+        DEBUG 2 "make_default_kde: No kde runtime detected"
+        return
+    fi
     DEBUG 2 "make_default_kde $vendor $mimetype"
     DEBUG 1 "Updating $default_file"
     mkdir -p "$default_dir"

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.