From d5a30724da10f470a4f9a470f2363d19e2afe788 Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Fri, 23 Jun 2017 15:20:37 +0530 Subject: [PATCH 1/2] chnages due to the file location of current sdk file formats --- .../java/org.carbon.android.emulator/TryIt.java | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 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 51ee83acf1..10ff7f0e80 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 @@ -814,13 +814,17 @@ public class TryIt { * @param fileName name of the file to set execution permission. */ private void setExecutePermission(String fileName) { - if (!new File(fileName).canExecute()) { - if (!new File(fileName).setExecutable(true)) { - System.out.println("Unable to set the execute permission of : " + fileName); - System.out.println("Please set the executable permission for file " - + new File(fileName).getAbsolutePath() + " to continue"); - System.exit(1); // if can't execute, unable to proceed + if (new File((fileName)).exists()) { + if (!new File(fileName).canExecute()) { + if (!new File(fileName).setExecutable(true)) { + System.out.println("Unable to set the execute permission of : " + fileName); + System.out.println("Please set the executable permission for file " + + new File(fileName).getAbsolutePath() + " to continue"); + System.exit(1); // if can't execute, unable to proceed + } } + } else { + System.out.println("WARN : " + fileName + " does not exists"); } } From abe08f85600a113d8594b924f65ca7bf24aecb6e Mon Sep 17 00:00:00 2001 From: Nirothipan Date: Fri, 23 Jun 2017 15:42:40 +0530 Subject: [PATCH 2/2] changes due to change in folder structure of SDK --- .../org.carbon.android.emulator/TryIt.java | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 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 10ff7f0e80..5ca395e3c6 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 @@ -766,6 +766,22 @@ public class TryIt { default: qemuSystemFileLocation += osSuffix + "-x86_64" + File.separator + "qemu-system-i386"; } + setExecutePermission(qemuSystemFileLocation); + + qemuSystemFileLocation = androidSdkHome + File.separator + "emulator" + File.separator + + "qemu" + File.separator; + + switch (osSuffix) { + case Constants.MAC_OS: + qemuSystemFileLocation += Constants.MAC_DARWIN + "-x86_64" + File.separator + "qemu-system-i386"; + break; + case Constants.WINDOWS_OS: + qemuSystemFileLocation += osSuffix + "-x86_64" + File.separator + "qemu-system-i386.exe"; + break; + default: + qemuSystemFileLocation += osSuffix + "-x86_64" + File.separator + "qemu-system-i386"; + } + killServer(); setExecutePermission(qemuSystemFileLocation); ExecutorService service = Executors.newSingleThreadExecutor(); @@ -823,8 +839,6 @@ public class TryIt { System.exit(1); // if can't execute, unable to proceed } } - } else { - System.out.println("WARN : " + fileName + " does not exists"); } }