[Title] fixed load sdk path in case of windows
authorYoonKi Park <yoonki.park@samsung.com>
Thu, 8 Dec 2011 08:18:01 +0000 (17:18 +0900)
committerYoonKi Park <yoonki.park@samsung.com>
Thu, 8 Dec 2011 08:18:01 +0000 (17:18 +0900)
com.samsung.tizen.common/src/com/samsung/tizen/common/properties/InstallPathConfig.java

index 1567502..d17110c 100644 (file)
@@ -28,7 +28,7 @@ import com.samsung.tizen.common.util.OSChecker;
 final public class InstallPathConfig {
         
        private static String sdkInstallPath;
-       private final static String SDKSUFFIX = "/.TizenSDK/tizensdkpath";
+       private final static String SDKSUFFIX = File.separatorChar+".TizenSDK"+File.separatorChar+"tizensdkpath";
        private final static String EMULATOR_PATH = "Emulator";
        private final static String INSTALLER_PATH = "InstallManager";
        
@@ -37,46 +37,48 @@ final public class InstallPathConfig {
                String sdkPath;
                
                if (OSChecker.isWindows()) {
-                       sdkPath = System.getenv("localappdata") + File.separatorChar + SDKSUFFIX;       
-                       
-                       if (HostUtil.exists(sdkPath)) 
-                               sdkInstallPath = sdkPath;
-                       else {
-                               DialogUtil.openMessageDialog("Tizen SDK is not installed propertly.");
-                               System.exit(0);
-                       }
+                       sdkPath = System.getenv("localappdata") + File.separatorChar + SDKSUFFIX;                               
+                       loadSdkPath(sdkPath);
                } else if (OSChecker.isLinux() == true || OSChecker.isUnix() == true || OSChecker.isMAC() == true) {
                        sdkPath= System.getProperty("user.home") + File.separatorChar + SDKSUFFIX;      
-                       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 propertly.");
-                                       System.exit(0);
-                               }
-                       } else {
-                               DialogUtil.openMessageDialog("Tizen SDK is not installed propertly.");
-                               System.exit(0);
-                       }
+                       loadSdkPath(sdkPath);
                } else {                        
                        DialogUtil.openMessageDialog(System.getProperty("os.name") + " is not supported currently.");
                        System.exit(0);
                }
        }
+       
        public static String getEmulatorPath(){
                return sdkInstallPath + File.separatorChar + EMULATOR_PATH;
        }       
+       
        public static String getIDEPath() { 
                // FIXME : can't help but putting the code due to the wac ide path , It has to be removed soon.
                return System.getProperty("user.dir");          
        }       
+       
        public static String getSDKPath() {
                return sdkInstallPath;
        }
+
        public static String getInstallManagerPath() {
                return sdkInstallPath + File.separatorChar + INSTALLER_PATH;
        }
+       
+       private static void loadSdkPath(String sdkPath) {
+               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 propertly.");
+                               System.exit(0);
+                       }
+               } else {
+                       DialogUtil.openMessageDialog("Tizen SDK is not installed propertly.");
+                       System.exit(0);
+               }
+       }
 }