From: Young Ik Cho Date: Tue, 9 Apr 2013 14:12:30 +0000 (+0900) Subject: update app launch path search logic X-Git-Tag: accepted/tizen_2.1/20130425.034849~121 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=f7b96d5b48ba010d52a10b536e1a2b8292e5b027;p=platform%2Fframework%2Fnative%2Fappfw.git update app launch path search logic Change-Id: I5e5dd9b7fdc44b4a864bbb65a94a4f9fa2784789 Signed-off-by: Young Ik Cho --- diff --git a/src/app/FApp_AppEntry.cpp b/src/app/FApp_AppEntry.cpp index 338c5be..2453678 100644 --- a/src/app/FApp_AppEntry.cpp +++ b/src/app/FApp_AppEntry.cpp @@ -146,7 +146,7 @@ GetAppIdAppExecutableNameFromPathNew(const char appName[], char* appId, char* ex { char buffer[PATH_MAX]; - // path is "/opt/apps/[appid]/bin/[executable_name]" + // path is ".../[appid]/bin/[executable_name]" memset(buffer, 0, PATH_MAX); const char* pRet = realpath(appName, buffer); diff --git a/src/app/FApp_AppInfo.cpp b/src/app/FApp_AppInfo.cpp index 69c3740..892a4f8 100644 --- a/src/app/FApp_AppInfo.cpp +++ b/src/app/FApp_AppInfo.cpp @@ -79,8 +79,10 @@ namespace Tizen { namespace App const int MAX_APIVERSION = 8; const int MAX_APPID = 10; +const char PACKAGE_PATH_FORMAT[] = "/opt/usr/apps/0000000000/"; const char PACKAGE_PATH_FORMAT2[] = "/opt/apps/0000000000/"; -const char PATH_ROOT[] = "/opt/apps/"; +const char PATH_ROOT[] = "/opt/usr/apps/"; +const char PATH_ROOT2[] = "/opt/apps/"; const char APPINFO_FILE_PATH[] = "info/version.info"; const char COMPAT_FILE_PATH[] = "info/compat.info"; const char TYPE_FILE_PATH[] = "info/type.info"; @@ -147,15 +149,35 @@ _AppInfo::Construct(const char* appId, const char* exeName, int argc, char* argv FILE* pFile = NULL; { + char appInfoPath[PATH_MAX] = {0, }; +#if 0 const int len = strlen(PACKAGE_PATH_FORMAT2); - char appInfoPath[len + 1]; strncpy(appInfoPath, PACKAGE_PATH_FORMAT2, len); appInfoPath[len] = '\0'; // due to possible dependency problem, FIoFile is not used // app root path first - strncpy(appInfoPath + strlen(PATH_ROOT), appId, MAX_APPID); + strncpy(appInfoPath + strlen(PATH_ROOT2), appId, MAX_APPID); +#else + // [FIXME] temporary code for directory location migration + int len = strlen(PACKAGE_PATH_FORMAT2); + strncpy(appInfoPath, PACKAGE_PATH_FORMAT2, len); + appInfoPath[len] = '\0'; + + if (access(appInfoPath, R_OK) != 0) + { + len = strlen(PACKAGE_PATH_FORMAT); + strncpy(appInfoPath, PACKAGE_PATH_FORMAT, len); + appInfoPath[len] = '\0'; + + strncpy(appInfoPath + strlen(PATH_ROOT), appId, MAX_APPID); + } + else + { + strncpy(appInfoPath + strlen(PATH_ROOT2), appId, MAX_APPID); + } +#endif // app root directory file descriptor __appRootDirFd = open(appInfoPath, O_RDONLY | O_CLOEXEC | O_DIRECTORY);