From: kh5325.kim Date: Wed, 23 Oct 2013 11:07:59 +0000 (+0900) Subject: package version up (2.1.108), Refined InstallPathConfig to lookup sdk.info file up... X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=04cdfe275a0176a290a3d7fe8d21c20fd9b7943f;p=sdk%2Fide%2Fcommon-eplugin.git package version up (2.1.108), Refined InstallPathConfig to lookup sdk.info file up-through Change-Id: I64937136b4a4f044133b839963464e1f5ebff977 Signed-off-by: kh5325.kim --- 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 cb86b7b..accd523 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 @@ -95,7 +95,13 @@ final public class InstallPathConfig { static { DIR_PLATFORMS_VER = "tizen" + DIR_PLATFORMS_VER_NUM; - loadSdkPath(); + try { + loadSdkPath(); + } catch (Exception e) { + String msg = "Failed to load sdk path"; + logger.error("Failed to load sdk path", e); + System.err.println(msg + ": " + e.getMessage()); + } } /** @@ -296,7 +302,7 @@ final public class InstallPathConfig { ProfileInfo latestProfileInfo = getLatestProfileInfo(); return latestProfileInfo == null ? "" : latestProfileInfo.getLatestPlatformName(); } - + /** * Returns platforms directory or null. */ @@ -355,7 +361,7 @@ final public class InstallPathConfig { public static String getSnippetsPath() { return getPlatformVersionPath() + File.separator + DIR_SNIPPETS; } - + /** * Returns a snippets path that is installed under the given profile and version.
* If this method cannot find the sample path, returns null. @@ -379,7 +385,7 @@ final public class InstallPathConfig { public static String getOnDemandPath() { return getPlatformVersionPath() + File.separator + DIR_ON_DEMAND; } - + /** * Returns a on-demand path that is installed under the given profile and version.
* If this method cannot find the sample path, returns null. @@ -478,33 +484,38 @@ final public class InstallPathConfig { prop.load(is); sdkInstallPath = prop.getProperty(SDK_INFO_FILE_KEY_INSTALLED_PATH); sdkDataPath = prop.getProperty(SDK_INFO_FILE_KEY_DATA_PATH); - logger.info(String.format("Loaded (install_path - %s, data_path - %s)", sdkInstallPath, sdkDataPath)); + logger.info(String.format("Loaded (install_path - %s, data_path - %s, sdk.info - %s)", sdkInstallPath, sdkDataPath, sdkInfoFile)); } finally { IOUtil.tryClose(is); } } - private static void loadSdkPath() { + private static void lookupSdkInfoFile(String path) { + String sdkPath = new File(path).getParent(); + while (sdkPath != null) { + try { + parseSdkInfoFile(sdkPath); + break; + } catch (FileNotFoundException e) { + // to find sdk.info up-through + logger.error("Failed to find: " + e.getMessage()); + sdkPath = new File(sdkPath).getParent(); + } catch (Exception e) { + logger.error("Failed to load from " + sdkPath, e); + } + } + } + + private static void loadSdkPath() throws Exception { try { String eclipsePath = org.eclipse.core.runtime.Platform.getInstallLocation().getURL().getPath(); - String sdkPath = new File(eclipsePath).getParent(); // to load from /../sdk.info - parseSdkInfoFile(sdkPath); + // if failed, to find sdk.info up-through + lookupSdkInfoFile(eclipsePath); } catch (NoClassDefFoundError ncdfe) { // in case of CLI, java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Platform String path = InstallPathConfig.class.getProtectionDomain().getCodeSource().getLocation().getPath(); - String sdkPath = new File(path).getParent(); - while (sdkPath != null) { - try { - parseSdkInfoFile(sdkPath); - break; - } catch (FileNotFoundException e) { - // to find sdk.info up-through - sdkPath = new File(sdkPath).getParent(); - } catch (Exception e) { - logger.error("Failed to load from " + sdkPath, e); - } - } + lookupSdkInfoFile(path); } catch (Throwable t) { logger.error("Failed to load from " + SDK_INFO_FILE, t); } finally { @@ -515,15 +526,14 @@ final public class InstallPathConfig { } } - private static void loadSdkPathFromDefault() { + private static void loadSdkPathFromDefault() throws Exception { // 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) ; } else if (OSChecker.isLinux() == true || OSChecker.isUnix() == true || OSChecker.isMAC() == true) { defaultHomePath = System.getProperty("user.home"); } else { - DialogUtil.openMessageDialog(System.getProperty("os.name") + " is not supported currently."); - System.exit(0); + throw new Exception(System.getProperty("os.name") + " is not supported currently."); } String sdkPath = defaultHomePath + File.separatorChar + SDKSUFFIX; @@ -545,8 +555,12 @@ final public class InstallPathConfig { } if (!status) { - DialogUtil.openMessageDialog("Tizen SDK is not installed properly."); - System.exit(0); + try { + DialogUtil.openMessageDialog("Tizen SDK is not installed properly."); + } catch (Exception e) { + logger.error("Failed to open a dialog", e); + } + throw new Exception("Tizen SDK is not installed properly."); } } diff --git a/org.tizen.common/src/org/tizen/common/core/application/tproject/TprojectHandler.java b/org.tizen.common/src/org/tizen/common/core/application/tproject/TprojectHandler.java index 34c0111..d9d83bb 100644 --- a/org.tizen.common/src/org/tizen/common/core/application/tproject/TprojectHandler.java +++ b/org.tizen.common/src/org/tizen/common/core/application/tproject/TprojectHandler.java @@ -92,7 +92,7 @@ public class TprojectHandler { File file = project.getFile(FILE_NAME).getLocation().toFile(); if ( !file.exists() ) { - logger.error("File does not exist. Check the file path. (project: %s, file: %s)", project, file); + logger.error(String.format("File does not exist. Check the file path. (project: %s, file: %s)", project, file)); return null; } @@ -135,5 +135,4 @@ public class TprojectHandler { return tProject; } - } diff --git a/package/changelog b/package/changelog index a84db97..bd026fc 100644 --- a/package/changelog +++ b/package/changelog @@ -1,3 +1,7 @@ +* 2.1.108 +- Refined InstallPathConfig to lookup sdk.info file up-through +- Fixed a clean build exception +== kh5325.kim 2013-10-23 * 2.1.107 - Modify sikuli test environment == bonyong.lee 2013-10-22 11:42 diff --git a/package/pkginfo.manifest b/package/pkginfo.manifest index 505a249..97672d7 100644 --- a/package/pkginfo.manifest +++ b/package/pkginfo.manifest @@ -1,4 +1,4 @@ -Version:2.1.107 +Version:2.1.108 Source:common-eplugin Maintainer:kangho kim , yoonki park , hyunsik non , taeyoung son , gune Kim , ho namkoong , hyeongseok heo , gyeongseok seo , jihoon song , changhyun lee , bonyong lee , shingil kang