skin: using binary path for external file access 92/20192/2
authorGiWoong Kim <giwoong.kim@samsung.com>
Tue, 29 Apr 2014 05:09:19 +0000 (14:09 +0900)
committerGiWoong Kim <giwoong.kim@samsung.com>
Wed, 30 Apr 2014 02:03:15 +0000 (11:03 +0900)
Change-Id: Idfdb1f0454bd17e341d721fec019eefd7f6dcef6
Signed-off-by: GiWoong Kim <giwoong.kim@samsung.com>
tizen/src/skin/client/src/org/tizen/emulator/skin/EmulatorSkinMain.java
tizen/src/skin/client/src/org/tizen/emulator/skin/util/SkinUtil.java

index 6c8ebbb01c18764f80ae9600f9af80952f097b9c..7bc8859aefce65098cc3e881ec208043dfa3fe09 100644 (file)
@@ -122,6 +122,7 @@ public class EmulatorSkinMain {
                                                ArgsConstants.VM_PATH + " in arguments is null.");
                        }
 
+                       /* initialize logging system */
                        SkinLogger.init(SkinLogLevel.DEBUG, vmPath);
 
                        logger = SkinLogger.getSkinLogger(EmulatorSkinMain.class).getLogger();
@@ -138,7 +139,7 @@ public class EmulatorSkinMain {
                        logger.info("swt platform : " + SWT.getPlatform());
                        logger.info("swt version : " + SWT.getVersion());
 
-                       logger.info("working directory" + System.getProperty("user.dir"));
+                       logger.info("working directory : " + System.getProperty("user.dir"));
 
                        /* startup arguments parsing */
                        Map<String, String> argsMap = parseArgs(args);
index e2c9ac5f779df7a476f39b584903b3639519f837..8cce8a619e085503116eda00cf2511f12f952778 100644 (file)
@@ -36,6 +36,7 @@ import java.lang.reflect.Array;
 import java.lang.reflect.Field;
 import java.lang.reflect.InvocationTargetException;
 import java.lang.reflect.Method;
+import java.net.URISyntaxException;
 import java.util.List;
 import java.util.Properties;
 import java.util.logging.Level;
@@ -78,6 +79,24 @@ public class SkinUtil {
        private static Logger logger =
                        SkinLogger.getSkinLogger(SkinUtil.class).getLogger();
 
+       private static String binaryPath;
+
+       static {
+               File executable = null;
+               try {
+                       executable = new File(SkinUtil.class.getProtectionDomain().getCodeSource()
+                                       .getLocation().toURI().getPath());
+               } catch (URISyntaxException e) {
+                       e.printStackTrace();
+               }
+
+               if (executable != null) {
+                       binaryPath = executable.getParent() + File.separator;
+               } else {
+                       binaryPath = "";
+               }
+       }
+
        private SkinUtil() {
                /* do nothing */
        }
@@ -151,21 +170,21 @@ public class SkinUtil {
                String sdbPath = null;
 
                if (SwtUtil.isWindowsPlatform()) {
-                       sdbPath = ".\\..\\..\\ansicon.exe";
+                       sdbPath = "..\\..\\ansicon.exe";
                } else {
-                       sdbPath = "./../../sdb";
+                       sdbPath = "../../sdb";
                }
 
-               return sdbPath;
+               return (binaryPath + sdbPath);
        }
 
        public static String getEcpPath() {
-               return "emulator-control-panel.jar";
+               return (binaryPath + "emulator-control-panel.jar");
        }
 
        public static String getSdkVersionFilePath() {
-               return ".." + File.separator + ".." + File.separator +
-                               ".." + File.separator + "sdk.version";
+               return (binaryPath + ".." + File.separator + ".." +
+                               File.separator + ".." + File.separator + "sdk.version");
        }
 
        public static List<KeyMapType> getHWKeyMapList(short rotationId) {
@@ -1044,18 +1063,12 @@ public class SkinUtil {
 
                logger.info("set Always on Top : " + isOnTop);
 
-               /* internal/Library.java::arch() */
-               String osArch = System.getProperty("os.arch"); /* $NON-NLS-1$ */
-
-               if (osArch.equals("amd64") || osArch.equals("x86_64") ||
-                               osArch.equals("IA64W") || osArch.equals("ia64")) {
-                       /* $NON-NLS-1$ $NON-NLS-2$ $NON-NLS-3$ */
-                       logger.info("64bit architecture : " + osArch);
-
+               if (SwtUtil.is64bitPlatform() == true) {
+                       logger.info("64bit architecture : " + System.getProperty("os.arch"));
                        return setTopMost64(shell, isOnTop); /* 64bit */
                }
 
-               logger.info("32bit architecture : " + osArch);
+               logger.info("32bit architecture : " + System.getProperty("os.arch"));
                return setTopMost32(shell, isOnTop); /* 32bit */
        }
 }