[Title] emulator-manager: modify file path resource
authorjihye kim <jihye1128.kim@samsung.com>
Sat, 8 Jun 2013 12:18:10 +0000 (21:18 +0900)
committerjihye kim <jihye1128.kim@samsung.com>
Sat, 8 Jun 2013 12:18:10 +0000 (21:18 +0900)
[Desc.] modify file path resource
[Issue] N/A

Change-Id: Ic2f44c0213b37587a8bd17658d2127344e8c21ad
Signed-off-by: jihye kim <jihye1128.kim@samsung.com>
package/emulator-manager.install.linux
src/org/tizen/emulator/manager/platform/BaseImage.java
src/org/tizen/emulator/manager/resources/FilePathResouces.java

index 8d177d4..65abc7f 100755 (executable)
@@ -32,5 +32,5 @@ else
 fi
 
 ## make $USERNAME.lock file
-echo ${USER_DATA_PATH} "${TIZEN_SDK_INSTALL_PATH}/tools/emulator/bin/.$USER.lock"
+echo ${USER_DATA_PATH} "${TIZEN_SDK_INSTALL_PATH}/tools/emulator/bin/.$USER.lock"
 exit 0
index 11004a8..159a56a 100644 (file)
@@ -51,7 +51,6 @@ public class BaseImage {
        protected String id = "0";
        protected String name;
        protected String version;
-       protected String releaseVersion;
        protected String domain;
        protected String cpu;
 
@@ -82,7 +81,6 @@ public class BaseImage {
                                        throw new IOException("Image name is null. This image can not add.");
                                }
                                version         = prop.getProperty(StringResources.IMAGE_VERSION, platform.getName());
-                               releaseVersion          = prop.getProperty(StringResources.RELEASE_VERSION, "Not identified");
                                domain          = prop.getProperty(StringResources.PRODUCT_DOMAIN, "Phone");
                                cpu                     = prop.getProperty(StringResources.TARGET_CPU, "x86");
                                cpu = cpu.toLowerCase();
@@ -121,7 +119,6 @@ public class BaseImage {
                                + "     Platform        : " + getPlatformName() + StringResources.NEW_LINE
                                + "     Type            : " + getType() + StringResources.NEW_LINE
                                + "     Version         : " + getVersion() + StringResources.NEW_LINE
-                               + "     Release Version : " + getRelease() + StringResources.NEW_LINE
                                + "     Target CPU      : " + getCpu() + StringResources.NEW_LINE
                                + "     Product Domain  : " + getDomain() + StringResources.NEW_LINE
                                + "     Base Disk Image Path : " + getPath() + StringResources.NEW_LINE;
@@ -158,10 +155,6 @@ public class BaseImage {
                return domain;
        }
 
-       public String getRelease() {
-               return releaseVersion;
-       }
-
        public String getName() {
                return name;
        }
index 780c8ae..9b9b683 100644 (file)
@@ -62,7 +62,7 @@ public class FilePathResouces {
        private final static String swap_suffix = File.separator + "swap";
        private final static String data_suffix = File.separator +"data";
 
-//     final static String sdkpath_suffix = File.separator + "tizensdkpath";
+       final static String sdkpath_suffix = File.separator + "tizensdkpath";
        final static String sdkdata_suffix = File.separator + "tizen-sdk-data";
        final static String win_sdb_exec = File.separator + "sdb.exe";
        final static String sdb_exec = File.separator + "sdb";
@@ -119,71 +119,10 @@ public class FilePathResouces {
                }
 
                // tizen_sdk path
-               String tizenSDKDataPath = "";
-               {
-                       // read sdk.info file
-                       File sdkInfoFile = new File(currentPath + File.separator + sdk_suffix+ sdkinfo_suffix);
-                       if (sdkInfoFile.exists()) {
-                                       BufferedReader in = null;
-                                       try {
-                                               in = new BufferedReader(new FileReader(sdkInfoFile));
-                                       } catch (FileNotFoundException e) {
-                                               EMLogger.getLogger().warning(e.getMessage());
-                                       }
-                                       String s = null;;
-                                       try {
-                                               while((s = in.readLine()) != null) {
-                                                       int i = s.indexOf("=");
-                                                       if (i != -1) {
-                                                               String s1 = s.substring(0, i);
-                                                               String s2 = s.substring(i+1, s.length());
-                                                               if (s1.equals("TIZEN_SDK_INSTALLED_PATH")) {
-                                                                       sdkPath = s2;
-                                                               } else if (s1.equals("TIZEN_SDK_DATA_PATH")) {
-                                                                       tizenSDKDataPath = s2;
-                                                               }
-                                                       }
-                                               }
-                                       } catch (IOException e) {
-                                               EMLogger.getLogger().warning(e.getMessage());
-                                       }
-
-                                       try {
-                                               in.close();
-                                       } catch (IOException e) {
-                                               EMLogger.getLogger().warning(e.getMessage());
-                                       }
-                       } else {
-                               // read .lock file
-                               File lockFile = new File(currentPath + File.separator
-                                               + "." + System.getProperty("user.name") + ".lock");
-                               if (lockFile.exists()) {
-                                       BufferedReader in = null;
-                                       try {
-                                               in = new BufferedReader(new FileReader(lockFile));
-                                       } catch (FileNotFoundException e) {
-                                               EMLogger.getLogger().warning(e.getMessage());
-                                       }
-                                       if (in != null) {
-                                               try {
-                                                       tizenSDKDataPath = in.readLine();
-                                               } catch (IOException e) {
-                                                       EMLogger.getLogger().warning(e.getMessage());
-                                               } finally {
-                                                       try {
-                                                               in.close();
-                                                       } catch (IOException e) {
-                                                               EMLogger.getLogger().warning(e.getMessage());
-                                                       }
-                                               }
-                                       }
-                               }
-                       }
-
-                       if (tizenSDKDataPath == null || tizenSDKDataPath.equals("")) {
-                               String home = System.getProperty("user.home");
-                               tizenSDKDataPath = home + sdkdata_suffix;
-                       }
+               String tizenSDKDataPath = findSDKDataPath();
+               if (tizenSDKDataPath == null || tizenSDKDataPath.equals("")) {
+                       String home = System.getProperty("user.home");
+                       tizenSDKDataPath = home + sdkdata_suffix;
                }
 
                if (sdkPath != null) {
@@ -262,6 +201,97 @@ public class FilePathResouces {
                dataSkinPath = workspacePath + skin_suffix;
        }
 
+       private static String findSDKDataPath() {
+               String dataPath = null;
+               // read sdk.info file
+               File sdkInfoFile = new File(currentPath + File.separator + sdk_suffix+ sdkinfo_suffix);
+               if (sdkInfoFile.exists()) {
+                               BufferedReader in = null;
+                               try {
+                                       in = new BufferedReader(new FileReader(sdkInfoFile));
+                               } catch (FileNotFoundException e) {
+                                       EMLogger.getLogger().warning(e.getMessage());
+                               }
+                               String s = null;;
+                               try {
+                                       while((s = in.readLine()) != null) {
+                                               int i = s.indexOf("=");
+                                               if (i != -1) {
+                                                       String s1 = s.substring(0, i);
+                                                       String s2 = s.substring(i+1, s.length());
+                                                       if (s1.equals("TIZEN_SDK_INSTALLED_PATH")) {
+                                                               sdkPath = s2;
+                                                       } else if (s1.equals("TIZEN_SDK_DATA_PATH")) {
+                                                               dataPath = s2;
+                                                       }
+                                               }
+                                       }
+                               } catch (IOException e) {
+                                       EMLogger.getLogger().warning(e.getMessage());
+                               }
+
+                               try {
+                                       in.close();
+                               } catch (IOException e) {
+                                       EMLogger.getLogger().warning(e.getMessage());
+                               }
+               }
+
+               if (dataPath == null || dataPath.isEmpty()) {
+                       // read .lock file
+                       File lockFile = new File(currentPath + File.separator
+                                       + "." + System.getProperty("user.name") + ".lock");
+                       if (lockFile.exists()) {
+                               BufferedReader in = null;
+                               try {
+                                       in = new BufferedReader(new FileReader(lockFile));
+                               } catch (FileNotFoundException e) {
+                                       EMLogger.getLogger().warning(e.getMessage());
+                               }
+                               if (in != null) {
+                                       try {
+                                               dataPath = in.readLine();
+                                       } catch (IOException e) {
+                                               EMLogger.getLogger().warning(e.getMessage());
+                                       } finally {
+                                               try {
+                                                       in.close();
+                                               } catch (IOException e) {
+                                                       EMLogger.getLogger().warning(e.getMessage());
+                                               }
+                                       }
+                               }
+                       }
+
+                       File f = null;
+                       if (dataPath != null && !dataPath.equals("")) {
+                               f = new File(dataPath + sdkpath_suffix);
+                       } else {
+                               String home = System.getProperty("user.home");
+                               f = new File(home + sdkdata_suffix + sdkpath_suffix);
+                       }
+
+                       if (f.exists()) {
+                               try {
+                                       BufferedReader in = new BufferedReader(new FileReader(f));
+                                       String s;
+                                       while((s = in.readLine()) != null) {
+                                               int i = s.indexOf("=");
+                                               if (i != -1) {
+                                                       String s2 = s.substring(i+1, s.length());
+                                                       sdkPath = s2;
+                                               }
+                                       }
+                                       in.close();
+                               } catch (IOException e) {
+                                       e.printStackTrace();
+                               }
+                       }
+               }
+
+               return dataPath;
+       }
+
        public static void testPrintPath() {
                System.out.println(currentPath);
                System.out.println(emulatorPath);
@@ -275,7 +305,6 @@ public class FilePathResouces {
                System.out.println(biosPath);
                System.out.println(workspacePath);
                System.out.println(vmsPath);
-
        }
 
        static FilePathResouces instance = null;