Adding default parameter

merge-requests/1/head
Nirothipan 7 years ago
parent 4cc74097d1
commit bf0d23a215

@ -494,17 +494,29 @@ public class TryIt {
/** /**
* This method gets the Android SDK location if available and sets the SDK path else downloads the SDK. * This method gets the Android SDK location if available and sets the SDK path else downloads the SDK.
*/ */
private int count = 0;
private void setAndroidSDK() { private void setAndroidSDK() {
sdkConfigFile = new File("sdkConfigLocation"); sdkConfigFile = new File("sdkConfigLocation");
if (!(sdkConfigFile.exists() && !sdkConfigFile.isDirectory())) { if (!(sdkConfigFile.exists() && !sdkConfigFile.isDirectory())) {
//TODO //TODO
Scanner read = new Scanner(System.in, StandardCharsets.UTF_8.toString()); Scanner read = new Scanner(System.in, StandardCharsets.UTF_8.toString());
System.out.print("Do you have an Android SDK installed on your computer (y/N) ? : "); System.out.print("Do you have an Android SDK installed on your computer (y/N) ? : ");
String response = read.next().toLowerCase(); String response = read.nextLine().toLowerCase();
if (response.matches("y")) { if (response.matches("y")) {
setSDKPath(); setSDKPath();
} else { } else if (response.matches("n") || response.matches("")) {
getAndroidSDK(); getAndroidSDK();
} else {
if (count < 5) {
System.out.println("Please enter a valid parameter .");
count++;
setAndroidSDK();
return;
} else {
System.out.println("Terminating process");
System.exit(1);
}
} }
} else { } else {
Scanner scanner = null; Scanner scanner = null;
@ -526,6 +538,10 @@ public class TryIt {
setExecutePermission(adbLocation); setExecutePermission(adbLocation);
} }
private void askForSDKLocation() {
System.out.println("Please enter a valid parameter .");
}
/** /**
* this method prints the exception and terminate the program. * this method prints the exception and terminate the program.
* *

Loading…
Cancel
Save