fix path handling
authorYoung Ik Cho <youngik.cho@samsung.com>
Thu, 11 Apr 2013 06:28:31 +0000 (15:28 +0900)
committerYoung Ik Cho <youngik.cho@samsung.com>
Thu, 11 Apr 2013 06:28:31 +0000 (15:28 +0900)
Change-Id: Id449d9a44f10d8722c1d6548783dfdea54839f13
Signed-off-by: Young Ik Cho <youngik.cho@samsung.com>
src/server/app/FApp_AulServer.cpp

index d886e96..dc3de34 100755 (executable)
@@ -73,7 +73,10 @@ const int _MAX_TIZEN_SVC_DESC_LEN = 1024;
 const int _MAX_CATEGORY = 12;
 const int _MAX_PACKAGE_ID_LENGTH = 10;
 
-const char _APP_PATH_FORMAT[] = "/opt/apps/0000000000/bin/%ls";
+const char _APP_PATH_FORMAT[] = "/opt/usr/apps/0000000000/bin/%ls";
+const char _APP_PATH_FORMAT2[] = "/opt/apps/0000000000/bin/%ls";
+const char PATH_ROOT[] = "/opt/usr/apps/";
+const char PATH_ROOT2[] = "/opt/apps/";
 
 }
 
@@ -294,14 +297,37 @@ int _AulServer::CreateProcess(const AppId& appId)
                char path[FILENAME_MAX];
                memset(path, '\0', FILENAME_MAX);
 
-               snprintf(path, FILENAME_MAX, _APP_PATH_FORMAT, appId.GetPointer() + 11);
+#if 0
+               snprintf(path, FILENAME_MAX, _APP_PATH_FORMAT2, appId.GetPointer() + 11);
 
-               int ret = wcstombs(path + strlen("/opt/apps/"), appId.GetPointer(), 10);
+               int ret = wcstombs(path + strlen(PATH_ROOT2), appId.GetPointer(), 10);
                if (ret == -1)
                {
                        SysLogException(NID_APP, E_SYSTEM, "Launching service (%ls)(%s) failed with [%s].", appId.GetPointer(), path, strerror(errno));
                        _Process::Exit(1);
                }
+#else
+               snprintf(path, FILENAME_MAX, _APP_PATH_FORMAT2, appId.GetPointer() + 11);
+
+               int ret = wcstombs(path + strlen(PATH_ROOT2), appId.GetPointer(), 10);
+               if (ret == -1)
+               {
+                       SysLogException(NID_APP, E_SYSTEM, "Launching service (%ls)(%s) failed with [%s].", appId.GetPointer(), path, strerror(errno));
+                       _Process::Exit(1);
+               }
+
+               if (access(path, R_OK) != 0)
+               {
+                       snprintf(path, FILENAME_MAX, _APP_PATH_FORMAT, appId.GetPointer() + 11);
+
+                       ret = wcstombs(path + strlen(PATH_ROOT), appId.GetPointer(), 10);
+                       if (ret == -1)
+                       {
+                               SysLogException(NID_APP, E_SYSTEM, "Launching service (%ls)(%s) failed with [%s].", appId.GetPointer(), path, strerror(errno));
+                               _Process::Exit(1);
+                       }
+               }
+#endif
 
                SysLog(NID_APP, "Launching %s.", path);