Chromium Code Reviews

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

Issue 151098: Patch from mdm@google.com... (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/xdg-utils/scripts/xdg-desktop-icon.in
===================================================================
--- third_party/xdg-utils/scripts/xdg-desktop-icon.in (revision 0)
+++ third_party/xdg-utils/scripts/xdg-desktop-icon.in (revision 0)
@@ -0,0 +1,151 @@
+#!/bin/sh
+#---------------------------------------------
+# xdg-desktop-icon
+#
+# Utility script to install desktop items on a Linux desktop.
+#
+# Refer to the usage() function below for usage.
+#
+# Copyright 2006, Kevin Krammer <kevin.krammer@gmx.at>
+# Copyright 2006, Jeremy White <jwhite@codeweavers.com>
+#
+# LICENSE:
+#
+#---------------------------------------------
+
+usage()
+{
+cat << _USAGE
+_USAGE
+}
+
+manualpage()
+{
+cat << _MANUALPAGE
+_MANUALPAGE
+}
+
+#@xdg-utils-common@
+
+[ x"$1" != x"" ] || exit_failure_syntax
+
+action=
+desktop_file=
+
+case $1 in
+ install)
+ action=install
+ ;;
+
+ uninstall)
+ action=uninstall
+ ;;
+
+ *)
+ exit_failure_syntax "unknown command '$1'"
+ ;;
+esac
+
+shift
+
+vendor=true
+while [ $# -gt 0 ] ; do
+ parm=$1
+ shift
+
+ case $parm in
+ --novendor)
+ vendor=false
+ ;;
+
+ -*)
+ exit_failure_syntax "unexpected option '$parm'"
+ ;;
+
+ *)
+ if [ -n "$desktop_file" ] ; then
+ exit_failure_syntax "unexpected argument '$parm'"
+ fi
+ if [ "$action" = "install" ] ; then
+ check_input_file "$parm"
+ fi
+ desktop_file=$parm
+ ;;
+ esac
+done
+
+# Shouldn't happen
+if [ -z "$action" ] ; then
+ exit_failure_syntax "command argument missing"
+fi
+
+if [ -z "$desktop_file" ] ; then
+ exit_failure_syntax "FILE argument missing"
+fi
+
+filetype=
+case $desktop_file in
+ *.desktop)
+ filetype=desktop
+ if [ "$vendor" = "true" -a "$action" = "install" ] ; then
+ check_vendor_prefix "$desktop_file"
+ fi
+ ;;
+ *)
+ filetype=other
+ ;;
+esac
+
+my_umask=077
+desktop_dir="$HOME/Desktop"
+desktop_dir_kde=`kde${KDE_SESSION_VERSION}-config --userpath desktop 2> /dev/null`
+if gconftool-2 -g /apps/nautilus/preferences/desktop_is_home_dir 2> /dev/null | grep true > /dev/null; then
+ desktop_dir_gnome="$HOME"
+ # Don't create $HOME/Desktop if it doesn't exist
+ [ -w $desktop_dir ] || desktop_dir=
+fi
+if [ -n "$desktop_dir_kde" ]; then
+ if [ ! -d "$desktop_dir_kde" ]; then
+ save_umask=`umask`
+ umask $my_umask
+ mkdir -p $desktop_dir_kde
+ umask $save_umask
+ fi
+ # Is the KDE desktop dir != $HOME/Desktop ?
+ if [ x`readlink -f "$desktop_dir"` != x`readlink -f "$desktop_dir_kde"` ]; then
+ # If so, don't create $HOME/Desktop if it doesn't exist
+ [ -w $desktop_dir ] || desktop_dir=
+ else
+ desktop_dir_kde=
+ fi
+fi
+desktop_dir="$desktop_dir $desktop_dir_kde $desktop_dir_gnome"
+
+basefile=`basename $desktop_file`
+
+DEBUG 1 "$action $desktop_file in $desktop_dir"
+
+case $action in
+ install)
+ save_umask=`umask`
+ umask $my_umask
+
+ for x in $desktop_dir ; do
+ mkdir -p $x
+ eval 'cp $desktop_file $x/$basefile'$xdg_redirect_output
+ done
+
+ umask $save_umask
+ ;;
+
+ uninstall)
+ for x in $desktop_dir ; do
+ rm -f $x/$basefile
+ done
+
+ ;;
+esac
+
+exit_success
+
+
« 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