-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathsetup-path
executable file
·68 lines (56 loc) · 1.96 KB
/
setup-path
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
#!/bin/bash
cd $(dirname $0)
SLIB_PATH=`pwd`
echo "SLIB_PATH=$SLIB_PATH"
echo "Creating Bash Setup Shell"
mkdir -p ~/.SLib.io
echo "export SLIB_PATH=$SLIB_PATH
export PATH=\$PATH:$SLIB_PATH/tool/bin" > ~/.SLib.io/setup_bash
chmod a+x ~/.SLib.io/setup_bash
if [[ `cat ~/.bash_profile` == *"source ~/.SLib.io/setup_bash"* ]]; then
echo "Setup Shell was already registered in ~/.bash_profile"
else
echo "Registering Setup Shell into ~/.bash_profile"
echo "" >> ~/.bash_profile
echo "source ~/.SLib.io/setup_bash" >> ~/.bash_profile
fi
if [[ `uname` == 'Linux' ]]; then
if [[ `cat ~/.bashrc` == *"source ~/.SLib.io/setup_bash"* ]]; then
echo "Setup Shell was already registered in ~/.bashrc"
else
echo "Registering Setup Shell into ~/.bashrc"
echo "" >> ~/.bashrc
echo "source ~/.SLib.io/setup_bash" >> ~/.bashrc
fi
if [[ -e ~/.kde/share/config/kdeveloprc ]]; then
echo "Registering KDevelop environment variable"
echo "[Environment Settings][default]" >> ~/.kde/share/config/kdeveloprc
echo "SLIB_PATH=$SLIB_PATH" >> ~/.kde/share/config/kdeveloprc
fi
fi
if [[ `uname` == 'Darwin' ]]; then
echo "Registering Xcode Preference Custom Path"
defaults write com.apple.dt.Xcode IDEApplicationwideBuildSettings -dict-add SLIB_PATH "$SLIB_PATH"
defaults write com.apple.dt.Xcode IDESourceTreeDisplayNames -dict-add SLIB_PATH "SLIB_PATH"
echo "Registering launchd environment variable"
echo "<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE plist PUBLIC '-//Apple//DTD PLIST 1.0//EN' 'http://www.apple.com/DTDs/PropertyList-1.0.dtd'>
<plist version="1.0">
<dict>
<key>Label</key>
<string>io.slib.setup_path</string>
<key>ProgramArguments</key>
<array>
<string>/bin/launchctl</string>
<string>setenv</string>
<string>SLIB_PATH</string>
<string>$SLIB_PATH</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>" > ~/Library/LaunchAgents/io.slib.setup_path.plist
launchctl setenv SLIB_PATH $SLIB_PATH
fi