Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/bin/sh | 1 #!/bin/sh |
| 2 #--------------------------------------------- | 2 #--------------------------------------------- |
| 3 # xdg-mime | 3 # xdg-mime |
| 4 # | 4 # |
| 5 # Utility script to manipulate MIME related information | 5 # Utility script to manipulate MIME related information |
| 6 # on XDG compliant systems. | 6 # on XDG compliant systems. |
| 7 # | 7 # |
| 8 # Refer to the usage() function below for usage. | 8 # Refer to the usage() function below for usage. |
| 9 # | 9 # |
| 10 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> | 10 # Copyright 2009-2010, Fathi Boudra <fabo@freedesktop.org> |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 238 make_default_generic() | 238 make_default_generic() |
| 239 { | 239 { |
| 240 # $1 is vendor-name.desktop | 240 # $1 is vendor-name.desktop |
| 241 # $2 is mime/type | 241 # $2 is mime/type |
| 242 # Add $2=$1 to XDG_DATA_HOME/applications/mimeapps.list | 242 # Add $2=$1 to XDG_DATA_HOME/applications/mimeapps.list |
| 243 xdg_user_dir="$XDG_DATA_HOME" | 243 xdg_user_dir="$XDG_DATA_HOME" |
| 244 [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" | 244 [ -n "$xdg_user_dir" ] || xdg_user_dir="$HOME/.local/share" |
| 245 default_file="$xdg_user_dir/applications/mimeapps.list" | 245 default_file="$xdg_user_dir/applications/mimeapps.list" |
| 246 DEBUG 2 "make_default_generic $1 $2" | 246 DEBUG 2 "make_default_generic $1 $2" |
| 247 DEBUG 1 "Updating $default_file" | 247 DEBUG 1 "Updating $default_file" |
| 248 [ -f $default_file ] || touch $default_file | |
|
Lei Zhang
2011/05/04 23:11:55
$default_file should be in double quotes in case t
Mike Mammarella
2011/05/04 23:19:44
Good catch. I've updated the line I copied this fr
| |
| 248 awk -v mimetype="$2" -v application="$1" ' | 249 awk -v mimetype="$2" -v application="$1" ' |
| 249 BEGIN { | 250 BEGIN { |
| 250 prefix=mimetype "=" | 251 prefix=mimetype "=" |
| 251 indefault=0 | 252 indefault=0 |
| 252 added=0 | 253 added=0 |
| 253 blanks=0 | 254 blanks=0 |
| 254 found=0 | 255 found=0 |
| 255 } | 256 } |
| 256 { | 257 { |
| 257 suppress=0 | 258 suppress=0 |
| (...skipping 603 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 861 rm -f $kde_dir/$x.desktop | 862 rm -f $kde_dir/$x.desktop |
| 862 fi | 863 fi |
| 863 done | 864 done |
| 864 ;; | 865 ;; |
| 865 esac | 866 esac |
| 866 | 867 |
| 867 update_mime_database $xdg_base_dir | 868 update_mime_database $xdg_base_dir |
| 868 | 869 |
| 869 exit_success | 870 exit_success |
| 870 | 871 |
| OLD | NEW |