On 3/30/2012 4:08 PM, Ken Brown wrote:
By the way, I initially tried to set the default for application/xml by using xdg-mime instead of directly creating a defaults.list file. But that doesn't work, because xdg-mime uses a grep command that fails if defaults.list doesn't exist. That strikes me as a bug. I would expect xdg-mime to create the file if it doesn't exist.
Patch attached.
--- origsrc/xdg-utils-1.1.0-rc1/scripts/xdg-mime 2011-01-01 05:03:14.000000000 -0500 +++ src/xdg-utils-1.1.0-rc1/scripts/xdg-mime 2012-03-31 13:19:46.769441000 -0400 @@ -658,7 +658,10 @@ make_default_generic() # Add $2=$1 to XDG_DATA_HOME/applications/defaults.list xdg_user_dir="$XDG_DATA_HOME" [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" - default_file="$xdg_user_dir/applications/defaults.list" + default_dir="$xdg_user_dir/applications" + default_file="$default_dir/defaults.list" + mkdir -p $default_dir + [ -f $default_file ] || touch $default_file DEBUG 2 "make_default_generic $1 $2" DEBUG 1 "Updating $default_file" grep -v "$2=" $default_file > ${default_file}.new 2> /dev/null