From b78fa34836b3cc0c6fb9a9fc2e1dc24b9ad65115 Mon Sep 17 00:00:00 2001 From: Bum-Sung Cho Date: Mon, 22 Apr 2013 21:42:10 +0900 Subject: [PATCH] Manage the executable name separately from the display name. Change-Id: I2ce7159f1f20dacf9adcc6a01a22cf5c9a12b151 Signed-off-by: Bum-Sung Cho --- src/app/FApp_ImeEntry.cpp | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/app/FApp_ImeEntry.cpp b/src/app/FApp_ImeEntry.cpp index 95b5312..6b4bd1b 100644 --- a/src/app/FApp_ImeEntry.cpp +++ b/src/app/FApp_ImeEntry.cpp @@ -57,6 +57,7 @@ static char** __pArgv = NULL; static char __appId[_MAX_BUFFER_SIZE]; static char __uuid[_MAX_BUFFER_SIZE]; static char __name[_MAX_BUFFER_SIZE]; +static char __exeName[_MAX_BUFFER_SIZE]; static char __language[_MAX_LANGUAGE_BUFFER_SIZE]; #ifdef __cplusplus @@ -393,6 +394,7 @@ scim_helper_module_set_path_info(const char* path) memset(__appId, '\0', _MAX_BUFFER_SIZE); memset(__uuid, '\0', _MAX_BUFFER_SIZE); memset(__name, '\0', _MAX_BUFFER_SIZE); + memset(__exeName, '\0', _MAX_BUFFER_SIZE); memset(__language, '\0', _MAX_LANGUAGE_BUFFER_SIZE); char symbolicLinkPath[_MAX_BUFFER_SIZE]; @@ -414,6 +416,12 @@ scim_helper_module_set_path_info(const char* path) // initialize ime info InitImeInfo(__uuid, __name, __language); + + // parse executable name + const char* pPath = strrchr(symbolicLinkPath, '/'); + const char* pExtension = strstr(symbolicLinkPath, ".exe"); + strncpy(__exeName, pPath + 1, pExtension - pPath - 1); + LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The executable name is %s.", __func__, __LINE__, __exeName); } bool _OSP_EXPORT_ @@ -466,7 +474,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe char binaryPath[_MAX_BUFFER_SIZE]; memset(binaryPath, '\0', _MAX_BUFFER_SIZE); - snprintf(binaryPath, _MAX_BUFFER_SIZE - 1, "/opt/apps/%s/bin/%s", __appId, __name); + snprintf(binaryPath, _MAX_BUFFER_SIZE - 1, "/opt/apps/%s/bin/%s", __appId, __exeName); LOG(LOG_DEBUG, _LOG_TAG_IME, "%s {%d) > The binary path is %s.", __func__, __LINE__, binaryPath); // set __pArgv @@ -488,7 +496,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe char packageName[_MAX_PACKAGE_NAME]; memset(packageName, '\0', _MAX_PACKAGE_NAME); - GetPackageNameFromAppIdAppExecutableName(__appId, __name, packageName, _MAX_PACKAGE_NAME); + GetPackageNameFromAppIdAppExecutableName(__appId, __exeName, packageName, _MAX_PACKAGE_NAME); AdjustPrivilege(packageName); } @@ -503,7 +511,7 @@ scim_helper_module_run_helper(const scim::String& uuid, const scim::ConfigPointe return; } - InitAppInfo(__appId, __name, __argc, __pArgv, fd); + InitAppInfo(__appId, __exeName, __argc, __pArgv, fd); // OspMain(__argc, __pArgv); -- 2.7.4