From: Young Ik Cho Date: Thu, 11 Apr 2013 06:28:31 +0000 (+0900) Subject: fix path handling X-Git-Tag: accepted/tizen_2.1/20130425.034849~90 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f163aaef9bf9d1a3ca0e44339331c1f23b8c37ed;p=framework%2Fosp%2Fappfw.git fix path handling Change-Id: Id449d9a44f10d8722c1d6548783dfdea54839f13 Signed-off-by: Young Ik Cho --- diff --git a/src/server/app/FApp_AulServer.cpp b/src/server/app/FApp_AulServer.cpp index d886e96..dc3de34 100755 --- a/src/server/app/FApp_AulServer.cpp +++ b/src/server/app/FApp_AulServer.cpp @@ -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);