forked from u0u0/Quick-Cocos2dx-Community
-
Notifications
You must be signed in to change notification settings - Fork 0
/
setup_mac.sh
executable file
·67 lines (51 loc) · 1.97 KB
/
setup_mac.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
#!/bin/bash
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
BASENAME=`basename "$DIR"`
QUICK_V3_ROOT="$DIR"
echo ""
echo "QUICK_V3_ROOT = \"$QUICK_V3_ROOT\""
echo ""
# set Xcode
IDEApplicationwideBuildSettings=`defaults read com.apple.dt.Xcode IDEApplicationwideBuildSettings`
if [ -z "$IDEApplicationwideBuildSettings" ]; then
defaults write com.apple.dt.Xcode IDEApplicationwideBuildSettings -dict
fi
defaults write com.apple.dt.Xcode IDEApplicationwideBuildSettings -dict-add QUICK_V3_ROOT "$QUICK_V3_ROOT"
IDESourceTreeDisplayNames=`defaults read com.apple.dt.Xcode IDESourceTreeDisplayNames`
if [ -z "$IDESourceTreeDisplayNames" ]; then
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict
fi
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add QUICK_V3_ROOT QUICK_V3_ROOT
echo "> Xcode settings updated."
# set quick player
defaults write org.cocos.quick.player QUICK_V3_ROOT "$QUICK_V3_ROOT"
echo "> quick player settings updated."
# set .bash_profile or .profile
if [ -f ~/.bash_profile ]; then
PROFILE_NAME=~/.bash_profile
else
PROFILE_NAME=~/.profile
fi
sed -e '/QUICK_V3_ROOT/d' $PROFILE_NAME | sed -e '/add by quick-cocos2d-x setup/d' > $PROFILE_NAME.tmp
DATE=`date "+DATE: %Y-%m-%d TIME: %H:%M:%S"`
echo "# add by quick-cocos2d-x setup, $DATE" >> $PROFILE_NAME.tmp
echo "export QUICK_V3_ROOT=\`cat ~/.QUICK_V3_ROOT\`" >> $PROFILE_NAME.tmp
DATE=`date "+%Y-%m-%d-%H%M%S"`
# cp $PROFILE_NAME $PROFILE_NAME-$DATE.bak
cp $PROFILE_NAME.tmp $PROFILE_NAME
rm $PROFILE_NAME.tmp
echo "> $PROFILE_NAME updated."
echo "$QUICK_V3_ROOT" > ~/.QUICK_V3_ROOT
echo "> ~/.QUICK_V3_ROOT updated."
echo ""
export QUICK_V3_ROOT=`cat ~/.QUICK_V3_ROOT`
# Create link for player at QuickRoot
sudo cp -Rf $QUICK_V3_ROOT"/quick/player/player3.app" /Applications/
# add x permission
sudo chmod -R 755 $QUICK_V3_ROOT"/quick/player/player3.app"
sudo chmod -R 755 /Applications/player3.app
echo "Player3 has installed in /Applications"
echo ""
echo ""
echo "done."
echo ""