From 8fb8cc9e2f27c5577682b87f4f715546dc7b373f Mon Sep 17 00:00:00 2001 From: "kh5325.kim" Date: Wed, 13 Mar 2013 22:35:29 +0900 Subject: [PATCH] Modified to tizen2.1 folder --- .../common/core/application/InstallPathConfig.java | 40 +++++++++------------- 1 file changed, 17 insertions(+), 23 deletions(-) diff --git a/org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java b/org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java index a2165e4..59749da 100755 --- a/org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java +++ b/org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java @@ -44,7 +44,7 @@ final public class InstallPathConfig { private static String sdkInstallPath; private static final String DIR_PLATFORMS = "platforms"; - private static final String DIR_PLATFORMS_VER = "tizen2.1"; + private static final String DIR_PLATFORMS_VER; private static final String DIR_SAMPLES = "samples"; private static final String DIR_SNIPPETS = "snippets"; private static final String DIR_ON_DEMAND = "on-demand"; @@ -61,12 +61,14 @@ final public class InstallPathConfig { // public static final String REGISTRY_APP_DATA_OF_SHELL_FOLDER = "AppData"; private static final String REGISTRY_LOCAL_APP_DATA_OF_SHELL_FOLDER = "\"Local AppData\""; // Value Column - private static final String REG_SZ = "REG_SZ"; + private static final String REG_VALUE = "REG_SZ"; static { + DIR_PLATFORMS_VER = "tizen2.1"; + // FIXME : don't need the following lines if using environment variable if (OSChecker.isWindows()) { - defaultHomePath = getRegistryValue(REGISTRY_PATH_OF_SHELL_FOLDER,REGISTRY_LOCAL_APP_DATA_OF_SHELL_FOLDER) ; + defaultHomePath = getRegistryValue(REGISTRY_PATH_OF_SHELL_FOLDER, REGISTRY_LOCAL_APP_DATA_OF_SHELL_FOLDER) ; } else if (OSChecker.isLinux() == true || OSChecker.isUnix() == true || OSChecker.isMAC() == true) { defaultHomePath = System.getProperty("user.home"); } else { @@ -92,13 +94,11 @@ final public class InstallPathConfig { //This is temporary code to get platform version path(only for one). //TODO: Should change to return string array type for various platform version paths. - public static String getPlatformVersionPath() - { + public static String getPlatformVersionPath() { String path = null; String platformPath = getSDKPath() + File.separator + DIR_PLATFORMS; File platforms = new File(platformPath); - if(platforms.isDirectory()) - { + if (platforms.isDirectory()) { // platforms.listFiles[0] can cause undetermined result like platforms/tmp.ini/sample path = platformPath + File.separator + DIR_PLATFORMS_VER; } @@ -106,20 +106,17 @@ final public class InstallPathConfig { } //TODO: Should change to get string array type for various platform version paths. - public static String getSamplesPath() - { + public static String getSamplesPath() { return getPlatformVersionPath() + File.separator + DIR_SAMPLES; } //TODO: Should change to get string array type for various platform version paths. - public static String getSnippetsPath() - { + public static String getSnippetsPath() { return getPlatformVersionPath() + File.separator + DIR_SNIPPETS; } //TODO: Should change to get string array type for various platform version paths. - public static String getOnDemandPath() - { + public static String getOnDemandPath() { return getPlatformVersionPath() + File.separator + DIR_ON_DEMAND; } @@ -133,12 +130,10 @@ final public class InstallPathConfig { public static String getSDBPath() { String toolsPath = getToolsPath(); - if (OSChecker.isWindows()) - { + if (OSChecker.isWindows()) { return toolsPath + File.separator + "sdb.exe"; } - else - { + else { return toolsPath + File.separator + "sdb"; } } @@ -167,8 +162,7 @@ final public class InstallPathConfig { boolean status = true; if (HostUtil.exists(sdkPath)) { String[] fileContent = HostUtil.getContents(sdkPath).split("="); - if (HostUtil.exists(fileContent[1])) - { + if (HostUtil.exists(fileContent[1])) { sdkInstallPath = fileContent[1]; } else { @@ -183,9 +177,9 @@ final public class InstallPathConfig { System.exit(0); } } + private static String getRegistryValue(String node, String key) { - if (!OSChecker.isWindows()) - { + if (!OSChecker.isWindows()) { return null; } @@ -200,9 +194,9 @@ final public class InstallPathConfig { String line = null; while ((line = br.readLine()) != null) { - int index = line.indexOf(REG_SZ); + int index = line.indexOf(REG_VALUE); if (index >= 0) { - value = line.substring(index + REG_SZ.length()).trim(); + value = line.substring(index + REG_VALUE.length()).trim(); } } } catch (IOException e) { -- 2.7.4