@@ -8,7 +8,16 @@ export JAVA_HOME="$SNAP/usr/lib/jvm/java-8-openjdk-amd64"
88export ANDROID_SDK_HOME=" $HOME /.Android"
99export _JAVA_OPTIONS=-Duser.home=$HOME
1010
11- if [ " $( ls -A $OLD_SDK_ROOT ) " ]; then
11+ for var in " $@ "
12+ do
13+ if [[ $var == * " --sdk_root" * ]]; then
14+ SDK_ROOT=${var: 11}
15+ fi
16+
17+ done
18+
19+ if [ -d " $OLD_SDK_ROOT " ] && [ ! -L " $OLD_SDK_ROOT " ] && [ " $( ls -A $OLD_SDK_ROOT ) " ]
20+ then
1221 echo " The default sdk folder has been changed from $OLD_SDK_ROOT to $SDK_ROOT ."
1322 echo " The Old location of sdk root have big problems with update the androidsdk package."
1423 echo " For more information about this problem see the https://github.com/QuasarApp/sdkmanager-android/issues/2 issue."
@@ -17,22 +26,29 @@ if [ "$(ls -A $OLD_SDK_ROOT)" ]; then
1726 if [ ! -d $SDK_ROOT ]
1827 then
1928 mkdir $SDK_ROOT
29+ else
30+ if [ " $( ls -A $SDK_ROOT ) " ]; then
31+ echo " The $SDK_ROOT dir is not empty. Please move all data to an another location and run the androdisdk again"
32+ exit 1
33+ else
34+ rm -d $SDK_ROOT
35+ fi
2036 fi
2137
2238 mv $OLD_SDK_ROOT $EXTERNAL_HOME
23- ln -s $SDK_ROOT $OLD_SDK_ROOT
24- echo " All your installed sdk files has been moved to new location."
25- echo " If you want change a sdk location please use the --sdk_root option."
2639
27- fi
40+ if [ " $? " = " 0" ]; then
41+ echo " All your installed sdk files has been moved to new location."
42+ echo " If you want change a sdk location please use the --sdk_root option."
43+ ln -s $SDK_ROOT $OLD_SDK_ROOT
44+ else
45+ echo " Unknown error occurred."
46+ echo " Please report this issue to us. You can report a problem here:"
47+ echo " https://github.com/QuasarApp/sdkmanager-android/issues/new"
48+ exit $status
49+ fi
2850
29- for var in " $@ "
30- do
31- if [[ $var == * " --sdk_root" * ]]; then
32- SDK_ROOT=${var: 11}
33- fi
34-
35- done
51+ fi
3652
3753echo " SDK_ROOT=$SDK_ROOT "
3854
0 commit comments