-
Notifications
You must be signed in to change notification settings - Fork 4
/
create_project_shortcuts.sh
executable file
·80 lines (66 loc) · 2.11 KB
/
create_project_shortcuts.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#!/bin/bash
usage() { echo "make-icon: [-n NICKNAME] projectName projectDir" 1>&2; exit; }
nickname=""
while getopts n: option
do
case "${option}"
in
n) nickname=${OPTARG}
shift
shift
;;
*)
usage
esac
done
if [ "$1" == "" ]||[ "$2" == "" ]; then
usage
fi
PROJECT_NAME="$1"
PROJECT_PATH="$2"
function icon {
icon_usage() { echo "icon: [-n NICKNAME] projectName projectDir scriptName scriptIcon script" 1>&2; exit; }
local nickname=""
local OPTIND n option
while getopts ":n:" option
do
case "${option}"
in
n) nickname=${OPTARG}
shift
shift
;;
esac
done
if [ "$1" == "" ]||[ "$2" == "" ]||[ "$3" == "" ]||[ "$4" == "" ]||[ "$5" == "" ]; then
icon_usage
fi
PROJECT_NAME="$1"
PROJECT_PATH="$2"
SOFTWARE_NAME="$3"
ICON="$4"
SCRIPT="$5"
if [ "$nickname" == "" ]; then
PROGRAM_NAME=${PROJECT_NAME}" "${SOFTWARE_NAME}
else
PROGRAM_NAME=$nickname
fi
NOSPACES=${SOFTWARE_NAME// /-}
FILENAME=${PROJECT_PATH}"/dcc_${NOSPACES,,}"
echo "#!/usr/bin/env xdg-open" > ${FILENAME}.desktop
echo "[Desktop Entry]" >> ${FILENAME}.desktop
echo "Version=0.1" >> ${FILENAME}.desktop
echo "Name=${PROGRAM_NAME}" >> ${FILENAME}.desktop
echo "Name[en_US]=${PROGRAM_NAME}" >> ${FILENAME}.desktop
echo "Comment=DCC Pipe shortcut for ${SOFTWARE_NAME}" >> ${FILENAME}.desktop
echo "Exec=${PROJECT_PATH}/${SCRIPT}" >> ${FILENAME}.desktop
echo "Icon=${PROJECT_PATH}/${ICON}" >> ${FILENAME}.desktop
echo "Terminal=false" >> ${FILENAME}.desktop
echo "Type=Application" >> ${FILENAME}.desktop
echo "Categories=Utility;Application;" >> ${FILENAME}.desktop
chmod 770 ${FILENAME}.desktop
}
icon -n "${nickname}aya" ${PROJECT_NAME} ${PROJECT_PATH} Maya pipe/tools/_resources/dcc-maya-icon.png launch/unix/maya.sh
icon -n "${nickname}ini" ${PROJECT_NAME} ${PROJECT_PATH} Houdini pipe/tools/_resources/dcc-houdini-icon.png launch/unix/hou.sh
icon -n "${nickname}uke" ${PROJECT_NAME} ${PROJECT_PATH} Nuke pipe/tools/_resources/dcc-nuke-icon.png launch/unix/nuke.sh
icon -n "${nickname}stancePainter" ${PROJECT_NAME} ${PROJECT_PATH} SubstancePainter pipe/tools/_resources/dcc-substancePainter-icon.png launch/unix/sbs.sh