@@ -8,7 +8,16 @@ export JAVA_HOME="$SNAP/usr/lib/jvm/java-8-openjdk-amd64"
8
8
export ANDROID_SDK_HOME=" $HOME /.Android"
9
9
export _JAVA_OPTIONS=-Duser.home=$HOME
10
10
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
12
21
echo " The default sdk folder has been changed from $OLD_SDK_ROOT to $SDK_ROOT ."
13
22
echo " The Old location of sdk root have big problems with update the androidsdk package."
14
23
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
17
26
if [ ! -d $SDK_ROOT ]
18
27
then
19
28
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
20
36
fi
21
37
22
38
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."
26
39
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
28
50
29
- for var in " $@ "
30
- do
31
- if [[ $var == * " --sdk_root" * ]]; then
32
- SDK_ROOT=${var: 11}
33
- fi
34
-
35
- done
51
+ fi
36
52
37
53
echo " SDK_ROOT=$SDK_ROOT "
38
54
0 commit comments