From 1b729295987000749362f4a031915feb80572f7f Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Mon, 31 Jul 2017 18:14:33 +0530 Subject: [PATCH] code clean up --- .../org.carbon.android.emulator/TryIt.java | 20 +++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryIt.java b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryIt.java index 58b2b27c4..8ed89e626 100644 --- a/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryIt.java +++ b/components/mobile-plugins/android-plugin/org.wso2.carbon.device.mgt.mobile.android.emulator/src/main/java/org.carbon.android.emulator/TryIt.java @@ -734,14 +734,26 @@ public class TryIt { if (!new File(haxmLocation).mkdirs()) { makeDirectoryError(haxmLocation, androidSdkHome); } + String haxmInstaller ; String folderName = "extras" + File.separator + "intel" + File.separator + "Hardware_Accelerated_Execution_Manager" + File.separator + "_haxm.zip"; getTools(System.getProperty(Constants.HAXM_URL), folderName); - String haxmInstaller = haxmLocation + File.separator + "HAXM installation"; - setExecutePermission(haxmInstaller); + ProcessBuilder processBuilder; + if(osSuffix.equals(Constants.MAC_OS) ) { + haxmInstaller = haxmLocation + File.separator + "HAXM installation"; + setExecutePermission(haxmInstaller); + processBuilder = new ProcessBuilder("sudo", haxmInstaller, "-m", "2048", "-log", + androidSdkHome + File.separator + "haxmSilentRun.log"); + } else { + haxmInstaller = haxmLocation + File.separator + "silent_install"; + haxmInstaller += Constants.WINDOWS_EXTENSION_BAT; + setExecutePermission(haxmInstaller); + processBuilder = new ProcessBuilder(haxmInstaller, "-m", "2048", "-log", + androidSdkHome + File.separator + "haxmSilentRun.log"); + } + + System.out.println("Installing intel HAXM..."); - ProcessBuilder processBuilder = new ProcessBuilder(haxmInstaller, "-m", "2048", "-log", - androidSdkHome + File.separator + "haxmSilentRun.log"); processBuilder.directory(new File(haxmLocation)); processBuilder.redirectInput(ProcessBuilder.Redirect.INHERIT); processBuilder.redirectOutput(ProcessBuilder.Redirect.INHERIT);