Define environment variable TMP as an alias for TEMP.
[wine.git] / tools / wineshelllink
blobb716e1efadeac3d36d71d1b131f6027fb0c02c25
1 #!/bin/sh
3 # Create menu/desktop entries for an application
4 # This is used by the IShellLink interface
6 # Copyright 2000 Alexandre Julliard
8 mode=""
9 args=""
10 menu=""
11 icon=""
12 descr=""
13 link=""
14 path=""
15 workdir=""
17 usage()
19 cat <<EOF
20 usage: wineshelllink options
22 options:
23 --desktop create a desktop link
24 --menu create a menu entry
25 --path xx path to the application
26 --link xx name of link to create
27 --args xx command-line arguments for the application
28 --icon xx icon to display
29 --workdir xx working directory for the application
30 --descr xx application description
32 EOF
33 exit 1
36 while [ $# -gt 0 ]
38 case "$1" in
39 (--desktop) mode="desktop"; shift 1 ;;
40 (--menu) mode="menu"; shift 1 ;;
41 (--path) path=$2; shift 2 ;;
42 (--link) link=$2; shift 2 ;;
43 (--args) args=$2; shift 2 ;;
44 (--icon) icon=$2; shift 2 ;;
45 (--descr) descr=$2; shift 2 ;;
46 (--workdir) workdir=$2; shift 2 ;;
47 (*) usage ;;
48 esac
49 done
51 kde_entry()
53 cat <<EOF
54 # KDE Config File
55 [KDE Desktop Entry]
56 Name=`basename "$link"`
57 Exec=wine "$path" $args
58 Type=Application
59 Comment=$descr
60 EOF
61 [ -z "$workdir" ] || echo "Path=\"$workdir\""
62 [ -z "$xpmicon" ] || echo "Icon=$xpmicon"
65 gnome_entry()
67 cat <<EOF
68 [Desktop Entry]
69 Name=`basename "$link"`
70 Exec=wine "$path" $args
71 Type=Application
72 Comment=$descr
73 EOF
74 [ -z "$workdir" ] || echo "Path=\"$workdir\""
75 [ -z "$xpmicon" ] || echo "Icon=$xpmicon"
78 # copy the icon file to a specified dir and set xpmicon to the resulting path
79 copy_icon()
81 dir=$1
82 mkdir -p "$dir"
83 mkdir -p "$dir/""`dirname "$link"`" || true
84 if [ -f "$icon" ]
85 then
86 cp "$icon" "$dir/$link.xpm"
87 xpmicon="$dir/$link.xpm"
88 else
89 xpmicon=""
93 # KDE
95 if [ -d "$HOME/.kde" ]
96 then
97 copy_icon "$HOME/.kde/share/applnk/Wine"
98 if [ $mode = "menu" ]
99 then
100 kde_entry > "$HOME/.kde/share/applnk/Wine/$link.kdelnk"
101 elif [ -d "$HOME/Desktop" ]
102 then
103 kde_entry > "$HOME/Desktop/$link.kdelnk"
107 # Gnome
109 if [ -d "$HOME/.gnome" ]
110 then
111 copy_icon "$HOME/.gnome/apps/Wine"
112 if [ $mode = "menu" ]
113 then
114 gnome_entry > "$HOME/.gnome/apps/Wine/$link.desktop"
115 elif [ -d "$HOME/.gnome-desktop" ]
116 then
117 gnome_entry > "$HOME/.gnome-desktop/$link.desktop"
121 exit 0