forked from TouchScript/TouchScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpackage_project.sh
More file actions
executable file
·45 lines (37 loc) · 1.05 KB
/
package_project.sh
File metadata and controls
executable file
·45 lines (37 loc) · 1.05 KB
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
if [[ $# -lt 3 ]] ; then
printf "\e[31mUsage: package_project.sh <project folder> <package name> <folders>\e[39m\n"
exit 0
fi
if [ ! -d "${1}" ]; then
printf "\e[31mError! Folder '${1}' does not exist.\e[39m\n"
exit 0
fi
printf "\n\e[32mBuilding package for '$1' to '$2'.\e[39m\n"
log="__log.txt"
# ".*" -> .*
temp="${3%\"}"
temp="${temp#\"}"
exportFolders="$temp"
if [ -f "$2" ]; then
rm $2
fi
cd $1
if [ "$(uname)" == "Darwin" ]; then
unityPath="/Applications/Unity/Unity.app/Contents/MacOS/Unity"
projectFolder=$(pwd)
separator="/"
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
unityPath="/c/Program Files (x86)/Unity/Editor/Unity.exe"
# Windows path
projectFolder=$(pwd | sed -e 's/^\/\([a-z]\)/\1:/g' -e 's/\//\\/g')
separator="\\"
fi
log="${projectFolder}${separator}${log}"
"$unityPath" -batchmode -logFile $log -projectPath "$projectFolder" -exportPackage $exportFolders $2 -quit
if [ ! -f $2 ]; then
cat "$log"
printf "\e[31mFailed to build $2!\e[39m\n"
rm "$log"
exit 0
fi
rm "$log"