$OpenBSD: patch-scripts_xdg-mime,v 1.7 2012/04/09 09:39:15 ajacoutot Exp $
--- scripts/xdg-mime.orig	Sat Jan  1 11:03:14 2011
+++ scripts/xdg-mime	Mon Apr  9 10:42:20 2012
@@ -676,11 +676,14 @@ defapp_generic()
     [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share"
     xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
     xdg_system_dirs="$XDG_DATA_DIRS"
-    [ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+    [ -n "$xdg_system_dirs" ] || xdg_system_dirs=${LOCALBASE}/share/:/usr/share/
 
     for x in `echo "$xdg_user_dir:$xdg_system_dirs" | sed 's/:/ /g'`; do
        DEBUG 2 "Checking $x/applications/defaults.list"
        trader_result=`grep "$MIME=" $x/applications/defaults.list 2> /dev/null | cut -d '=' -f 2 | cut -d ';' -f 1`
+       if [ -z "$trader_result" ] ; then
+          trader_result=`grep "$MIME=" $x/applications/mimeinfo.cache  2> /dev/null | cut -d '=' -f 2 | cut -d ';' -f 1`
+       fi
        if [ -n "$trader_result" ] ; then
           echo $trader_result
           exit_success
@@ -952,7 +955,7 @@ xdg_user_dir="$XDG_DATA_HOME"
 xdg_user_dir="$xdg_user_dir/$xdg_dir_name"
 
 xdg_system_dirs="$XDG_DATA_DIRS"
-[ -n "$xdg_system_dirs" ] || xdg_system_dirs=/usr/local/share/:/usr/share/
+[ -n "$xdg_system_dirs" ] || xdg_system_dirs=${LOCALBASE}/share/:/usr/share/
 for x in `echo $xdg_system_dirs | sed 's/:/ /g'`; do
     if [ -w $x/$xdg_dir_name ] ; then
         [ x"$mode" = x"system" ] && xdg_base_dir="$x/mime"
@@ -984,7 +987,7 @@ DEBUG 3 "kde_global_dir: $kde_global_dir"
 # TODO: Gnome legacy support
 # See http://forums.fedoraforum.org/showthread.php?t=26875
 gnome_user_dir="$HOME/.gnome/apps"
-gnome_global_dir=/usr/share/gnome/apps
+gnome_global_dir=${LOCALBASE}/share/gnome/apps
 [ -w $gnome_global_dir ] || gnome_global_dir=
 DEBUG 3 "gnome_user_dir: $gnome_user_dir"
 DEBUG 3 "gnome_global_dir: $gnome_global_dir"
