public Platform(String name) {
this.platformName = name;
- this.platformPath = FilePathResources.getPlatformsPath()
- + File.separator + platformName;
+// this.platformPath = FilePathResources.getPlatformsPath()
+// + File.separator + platformName;
+ this.platformPath = FilePathResources.getPlatformsPath() + File.separator
+ + getPlatformPath(platformName);
loadProperties();
if (!imageList.isEmpty()) {
}
}
+ public static String getPlatformPath(String platformName) {
+ String split[] = platformName.split("-");
+ if (split != null && split.length == 2) {
+ String profile = split[0];
+ String ver = split[1];
+ return "tizen" + "-" + ver + File.separator + profile;
+ }
+ EMLogger.getLogger().warning("Failed to get platformpath from platform name : " + platformName);
+ return "";
+ }
+
private void loadProperties() {
if (platformPath == null) {
return;
File platforms = new File(FilePathResources.getPlatformsPath());
if (platforms.isDirectory() && platforms.exists()) {
+// for (File platform : platforms.listFiles()) {
+// if (platform.isDirectory()) {
+// Platform p = new Platform(platform.getName());
+// if (!p.getImageList().isEmpty()) {
+// //platformList.add(p);
+// addPlatform(p);
+// //addProfile(p.getProfile());
+// }
+// }
+// }
for (File platform : platforms.listFiles()) {
if (platform.isDirectory()) {
- Platform p = new Platform(platform.getName());
- if (!p.getImageList().isEmpty()) {
- //platformList.add(p);
- addPlatform(p);
- //addProfile(p.getProfile());
+ for (File profile : platform.listFiles()) {
+ if (profile.isDirectory()) {
+ String versionSplit[] = platform.getName().split("-");
+ if (versionSplit != null && versionSplit.length == 2) {
+ Platform p = new Platform(profile.getName() + "-" + versionSplit[1]);
+ if (!p.getImageList().isEmpty()) {
+ //platformList.add(p);
+ addPlatform(p);
+ //addProfile(p.getProfile());
+ }
+ }
+
+ }
}
}
}
private final static String em_images_suffix = File.separator + "emulator-images";
private final static String resource_suffix = File.separator + "emulator-resources";
private final static String old_default_suffix = File.separator + "default";
+ private final static String common_suffix = File.separator + "common";
+ private final static String platform_prefix = File.separator + "tizen-";
// private final static String addons_suffix = File.separator + "add-ons";
// private final static String x86_extension = ".x86";
// private final static String arm_extension = ".arm";
private final static String sdkdata_new_emulator_suffix = File.separator + "emulator";
private final static String vms_suffix = File.separator + "vms";
+ private final static String qemuImg_suffic = File.separator + "qemu-img";
+
private static String currentPath;
private static String sdkPath = null;
private static String platformsPath;
public static String getBinPath(){
return binPath;
}
+
+ public static String getEmulatorBinPath(String platformVersion) {
+ return getEmulatorPath(platformVersion) + bin_suffix;
+ }
+
+ public static String getEmulatorKernelPath(String platformVersion) {
+ return getEmulatorDataPath(platformVersion) + kernel_suffix;
+ }
+
+ public static String getEmulatorBiosPath(String platformVersion) {
+ return getEmulatorDataPath(platformVersion) + bios_suffix;
+ }
+
+ public static String getEmulatorQemuImgPath(String platformVersion) {
+ return getEmulatorBinPath(platformVersion) + qemuImg_suffic;
+ }
+
+ public static String getEmulatorDataPath(String platformVersion) {
+ return getEmulatorPath(platformVersion) + data_suffix;
+ }
+
+ public static String getEmulatorPath(String platformVersion) {
+ String emulatorPath;
+ try {
+ emulatorPath = new File(platformsPath + platform_prefix
+ + platformVersion + common_suffix + emulator_suffix).getCanonicalPath();
+ } catch (IOException e) {
+ emulatorPath = platformsPath + platform_prefix
+ + platformVersion + common_suffix + emulator_suffix;
+ }
+ return emulatorPath;
+ }
/*
public String getArchPath(){
return arcPath;
}
private void createSwapImageInternal(String basePath, String targetPath) throws VMCreatorException {
- String exe_path = FilePathResources.getBinPath() + File.separator + "qemu-img";
+ String exe_path = getQemuImgPath();
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
}
private void checkCustomBaseImage(final String path) throws VMCreatorException {
- String exe_path = FilePathResources.getBinPath() + File.separator + "qemu-img";
+ String exe_path = getQemuImgPath();
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
}
public void createInitialVMImageInternal(String baseImagePath, String targetImagePath) throws VMCreatorException {
- String exe_path = FilePathResources.getBinPath() + File.separator + "qemu-img";
+ String exe_path = getQemuImgPath();
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);
new Creator().createSwapImageInternal(basePath, targetPath);
}
+ private String getQemuImgPath() {
+// return FilePathResources.getBinPath() + File.separator + "qemu-img";
+ return FilePathResources.getEmulatorQemuImgPath(newVM.version);
+ }
+
}
throw new VMWorkerException("File does not exist :" + baseImage.getAbsolutePath());
}
- String exe_path = FilePathResources.getBinPath() + File.separator + "qemu-img";
+ String exe_path = FilePathResources.getEmulatorQemuImgPath(property.getPropertyValue().version);
List<String> cmd = new ArrayList<String>();
cmd.add(exe_path);