From: minkee.lee Date: Thu, 11 Jun 2015 09:54:27 +0000 (+0900) Subject: path: Fixed emulator tool path. X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=09f2e687531304c484921e3df4c0656459e6e38d;p=sdk%2Femulator%2Femulator-manager.git path: Fixed emulator tool path. - Find path of latest version. Change-Id: Ib0999afecb7d41d5d3073b7abc7e6f19b6436965 Signed-off-by: minkee.lee --- diff --git a/src/org/tizen/emulator/manager/resources/FilePathResources.java b/src/org/tizen/emulator/manager/resources/FilePathResources.java index 85c71b0..9487ae3 100644 --- a/src/org/tizen/emulator/manager/resources/FilePathResources.java +++ b/src/org/tizen/emulator/manager/resources/FilePathResources.java @@ -39,6 +39,9 @@ import java.net.URISyntaxException; import org.tizen.emulator.manager.EmulatorManager; import org.tizen.emulator.manager.logging.EMLogger; +import org.tizen.emulator.manager.platform.Platform; +import org.tizen.emulator.manager.platform.Profile; +import org.tizen.emulator.manager.platform.ProfileList; import org.tizen.emulator.manager.vms.EmulatorVMList; public class FilePathResources { @@ -375,13 +378,13 @@ public class FilePathResources { public static String getEmulatorToolPath() { // TODO return /tools/emulator/bin - return getEmulatorPath("2.4") + bin_suffix; + return getEmulatorPath(getLatestPlatformVersion()) + bin_suffix; } public static String getEmulatorPath(String platformVersion) { - String emulatorPath; + String emulatorPath = ""; if (platformVersion == null || platformVersion.isEmpty()) { - platformVersion = "2.4"; // TODO Get lastest version. + platformVersion = getLatestPlatformVersion(); } try { emulatorPath = new File(platformsPath + platform_prefix @@ -392,6 +395,21 @@ public class FilePathResources { } return emulatorPath; } + + // Return latest platform version in whole profile. + private static String getLatestPlatformVersion() { + String latestVersion = "0"; + for (Profile profile : ProfileList.getProfileList()) { + Platform platform = profile.getPlatformByLatestVersion(); + if (platform != null) { + int compare = latestVersion.compareTo(platform.getVersion()); + if (compare < 0) { // totalLatestVesion < platform.getVersion() + latestVersion = platform.getVersion(); + } + } + } + return latestVersion; + } /* public String getArchPath(){ return arcPath;