[Title] Modified SDK directory structure
authorkh5325.kim <kh5325.kim@samsung.com>
Wed, 18 Jul 2012 13:59:19 +0000 (22:59 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Wed, 18 Jul 2012 13:59:19 +0000 (22:59 +0900)
[Type]
[Module]
[Priority]
[CQ#]
[Redmine#]
[Problem]
[Cause]
[Solution]
[TestCase]

org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java

index 0a65a88..a4234f5 100644 (file)
@@ -39,9 +39,7 @@ import org.tizen.common.util.OSChecker;
 final public class InstallPathConfig {
 
     private static String sdkInstallPath;
-    private final static String SDKSUFFIX = ".TizenSDK"+File.separatorChar+"tizensdkpath";
-    private final static String EMULATOR_PATH = "Emulator";
-    private final static String INSTALLER_PATH = "InstallManager";
+    private final static String SDKSUFFIX = ".TizenSDK" + File.separatorChar + "tizensdkpath";
 
     // Registry Key
     private static final String REGISTRY_PATH_OF_SHELL_FOLDER = "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Shell Folders";
@@ -50,6 +48,10 @@ final public class InstallPathConfig {
     // Value Column
     private static final String REG_SZ = "REG_SZ";
 
+    private static final String DIR_EMULATOR = "emulator";
+    private static final String DIR_INSTALLER = "install-manager";
+    private static final String DIR_TOOLS = "tools";
+
     static {
         // FIXME : don't need the following lines if using environment variable
         String sdkPath;
@@ -67,10 +69,6 @@ final public class InstallPathConfig {
         }
     }
 
-    public static String getEmulatorPath(){
-        return sdkInstallPath + File.separatorChar + EMULATOR_PATH;
-    }
-
     /**
      * @deprecated Use {@link #getSDKPath()} instead.
      */
@@ -84,31 +82,44 @@ final public class InstallPathConfig {
         return sdkInstallPath;
     }
 
+    private static String getToolsPath() {
+        return getSDKPath() + File.separator + DIR_TOOLS;
+    }
+
     public static String getSDBPath() {
+        String toolsPath = getToolsPath();
         if (OSChecker.isWindows())
-            return getSDKPath() + File.separator + "SDK" + File.separator + "sdb" + File.separator + "sdb.exe";
+            return toolsPath + File.separator + "sdb.exe";
         else
-            return getSDKPath() + File.separator + "SDK" + File.separator + "sdb" + File.separator + "sdb";
+            return toolsPath + File.separator + "sdb";
     }
 
     public static String getSdbWinUsbApiPath() {
-        return getSDKPath() + File.separator + "SDK" + File.separator + "sdb" + File.separator + "SdbWinUsbApi.dll";
+        return getToolsPath() + File.separator + "SdbWinUsbApi.dll";
     }
 
     public static String getInstallManagerPath() {
-        return sdkInstallPath + File.separatorChar + INSTALLER_PATH;
+        return getSDKPath() + File.separator + DIR_INSTALLER;
+    }
+
+    public static String getEmulatorPath() {
+        return getToolsPath() + File.separator + DIR_EMULATOR;
     }
 
     private static void loadSdkPath(String sdkPath) {
+        boolean status = true;
         if (HostUtil.exists(sdkPath)) {
             String[] fileContent = HostUtil.getContents(sdkPath).split("=");
             if (HostUtil.exists(fileContent[1]))
                 sdkInstallPath = fileContent[1];
             else {
-                DialogUtil.openMessageDialog("Tizen SDK is not installed properly.");
-                System.exit(0);
+                status = false;
             }
         } else {
+            status = false;
+        }
+
+        if (!status) {
             DialogUtil.openMessageDialog("Tizen SDK is not installed properly.");
             System.exit(0);
         }
@@ -127,21 +138,19 @@ final public class InstallPathConfig {
             br = new BufferedReader(new InputStreamReader(process.getInputStream(), encoding));
 
             String line = null;
-            while((line = br.readLine()) != null) {
+            while ((line = br.readLine()) != null) {
                 int index = line.indexOf(REG_SZ);
                 if (index >= 0) {
                     value = line.substring(index + REG_SZ.length()).trim();
                 }
             }
         } catch (IOException e) {
-            // TODO Auto-generated catch block
             e.printStackTrace();
         } finally {
             if (br != null) {
                 try {
                     br.close();
                 } catch (IOException e) {
-                    // TODO Auto-generated catch block
                     e.printStackTrace();
                 }
             }