Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3)

Side by Side Diff: third_party/xdg-utils/scripts/xdg-desktop-icon.in

Issue 3273010: Update our copy of xdg-utils to 2010-08-30, and include a patched xdg-mime. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/deps/
Patch Set: Created 10 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 #!/bin/sh 1 #!/bin/sh
2 #--------------------------------------------- 2 #---------------------------------------------
3 # xdg-desktop-icon 3 # xdg-desktop-icon
4 # 4 #
5 # Utility script to install desktop items on a Linux desktop. 5 # Utility script to install desktop items on a Linux desktop.
6 # 6 #
7 # Refer to the usage() function below for usage. 7 # Refer to the usage() function below for usage.
8 # 8 #
9 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at> 9 # Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
10 # Copyright 2006, Jeremy White <jwhite@codeweavers.com> 10 # Copyright 2006, Jeremy White <jwhite@codeweavers.com>
11 # 11 #
12 # LICENSE: 12 # LICENSE:
13 # 13 #
14 #--------------------------------------------- 14 #---------------------------------------------
15 15
16 usage() 16 usage()
17 { 17 {
18 cat << _USAGE 18 cat << _USAGE
19 _USAGE 19 _USAGE
20 } 20 }
21 21
22 manualpage() 22 manualpage()
23 { 23 {
24 cat << _MANUALPAGE 24 cat << _MANUALPAGE
25 _MANUALPAGE 25 _MANUALPAGE
26 } 26 }
27 27
28 #@xdg-utils-common@ 28 #@xdg-utils-common@
29 29
30 [ x"$1" != x"" ] || exit_failure_syntax 30 [ x"$1" != x"" ] || exit_failure_syntax
31 31
32 action= 32 action=
33 desktop_file= 33 desktop_file=
34 34
35 case $1 in 35 case $1 in
36 install) 36 install)
37 action=install 37 action=install
38 ;; 38 ;;
39 39
40 uninstall) 40 uninstall)
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 # Shouldn't happen 77 # Shouldn't happen
78 if [ -z "$action" ] ; then 78 if [ -z "$action" ] ; then
79 exit_failure_syntax "command argument missing" 79 exit_failure_syntax "command argument missing"
80 fi 80 fi
81 81
82 if [ -z "$desktop_file" ] ; then 82 if [ -z "$desktop_file" ] ; then
83 exit_failure_syntax "FILE argument missing" 83 exit_failure_syntax "FILE argument missing"
84 fi 84 fi
85 85
86 filetype= 86 filetype=
87 case $desktop_file in 87 case "$desktop_file" in
88 *.desktop) 88 *.desktop)
89 filetype=desktop 89 filetype=desktop
90 if [ "$vendor" = "true" -a "$action" = "install" ] ; then 90 if [ "$vendor" = "true" -a "$action" = "install" ] ; then
91 check_vendor_prefix "$desktop_file" 91 check_vendor_prefix "$desktop_file"
92 fi 92 fi
93 ;; 93 ;;
94 *) 94 *)
95 filetype=other 95 filetype=other
96 ;; 96 ;;
97 esac 97 esac
98 98
99 my_umask=077 99 my_umask=077
100 desktop_dir="$HOME/Desktop" 100 desktop_dir="$HOME/Desktop"
101 if xdg-user-dir 2>/dev/null 1>&2; then
102 desktop_dir=`xdg-user-dir DESKTOP`
103 fi
101 desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/nul l` 104 desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/nul l`
102 if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null | grep true > /dev/null; then 105 if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null | grep true > /dev/null; then
103 desktop_dir_gnome="$HOME" 106 desktop_dir_gnome="$HOME"
104 # Don't create $HOME/Desktop if it doesn't exist 107 # Don't create $HOME/Desktop if it doesn't exist
105 [ -w $desktop_dir ] || desktop_dir= 108 [ -w "$desktop_dir" ] || desktop_dir=
106 fi 109 fi
107 if [ -n "$desktop_dir_kde" ]; then 110 if [ -n "$desktop_dir_kde" ]; then
108 if [ ! -d "$desktop_dir_kde" ]; then 111 if [ ! -d "$desktop_dir_kde" ]; then
109 save_umask=`umask` 112 save_umask=`umask`
110 umask $my_umask 113 umask $my_umask
111 mkdir -p $desktop_dir_kde 114 mkdir -p "$desktop_dir_kde"
112 umask $save_umask 115 umask $save_umask
113 fi 116 fi
114 # Is the KDE desktop dir != $HOME/Desktop ? 117 # Is the KDE desktop dir != $HOME/Desktop ?
115 if [ x`readlink -f "$desktop_dir"` != x`readlink -f "$desktop_dir_kde"` ]; t hen 118 if [ x`readlink -f "$desktop_dir"` != x`readlink -f "$desktop_dir_kde"` ]; t hen
116 # If so, don't create $HOME/Desktop if it doesn't exist 119 # If so, don't create $HOME/Desktop if it doesn't exist
117 [ -w $desktop_dir ] || desktop_dir= 120 [ -w "$desktop_dir" ] || desktop_dir=
118 else 121 else
119 desktop_dir_kde= 122 desktop_dir_kde=
120 fi 123 fi
121 fi 124 fi
122 desktop_dir="$desktop_dir $desktop_dir_kde $desktop_dir_gnome"
123 125
124 basefile=`basename "$desktop_file"` 126 basefile=`basename "$desktop_file"`
125 127
126 DEBUG 1 "$action $desktop_file in $desktop_dir" 128 DEBUG 1 "$action $desktop_file in $desktop_dir $desktop_dir_kde $desktop_dir_gno me"
127 129
128 case $action in 130 case $action in
129 install) 131 install)
130 save_umask=`umask` 132 save_umask=`umask`
131 umask $my_umask 133 umask $my_umask
132 134
133 for x in $desktop_dir ; do 135 for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do
134 mkdir -p $x 136 if [ -n "$x" ]; then
135 eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output 137 mkdir -p "$x"
138 eval 'cp "$desktop_file" "$x/$basefile"'$xdg_redirect_output
139 fi
136 done 140 done
137 141
138 umask $save_umask 142 umask $save_umask
139 ;; 143 ;;
140 144
141 uninstall) 145 uninstall)
142 for x in $desktop_dir ; do 146 for x in "$desktop_dir" "$desktop_dir_kde" "$desktop_dir_gnome" ; do
143 rm -f $x/$basefile 147 if [ -n "$x" ]; then
148 rm -f "$x/$basefile"
149 fi
144 done 150 done
145 151
146 ;; 152 ;;
147 esac 153 esac
148 154
149 exit_success 155 exit_success
150 156
151 157
OLDNEW
« no previous file with comments | « third_party/xdg-utils/scripts/xdg-desktop-icon ('k') | third_party/xdg-utils/scripts/xdg-desktop-menu » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698