Support to load module in inhouse IME directory 94/65094/4
authorJihoon Kim <jihoon48.kim@samsung.com>
Thu, 7 Apr 2016 07:54:18 +0000 (16:54 +0900)
committerJihoon Kim <jihoon48.kim@samsung.com>
Thu, 7 Apr 2016 10:28:39 +0000 (19:28 +0900)
Change-Id: I7cd0d972f45decd26bd042b53e9378741dac8c19

ism/src/isf_pkg.cpp

index 6f8997c..ecd0997 100644 (file)
 #include <pkgmgr-info.h>
 #endif
 #include <scim_panel_common.h>
-#include "isf_query_utility.h"
-#include "isf_pkg.h"
 #include <dlog.h>
 #include <tzplatform_config.h>
+#include <sys/stat.h>
+#include "isf_query_utility.h"
+#include "isf_pkg.h"
 
 #ifdef LOG_TAG
 # undef LOG_TAG
@@ -153,9 +154,20 @@ int isf_pkg_ime_app_list_cb (const pkgmgrinfo_appinfo_h handle, void *user_data)
 #else
             ime_db.options = SCIM_HELPER_STAND_ALONE | SCIM_HELPER_NEED_SCREEN_INFO | SCIM_HELPER_AUTO_RESTART;
 #endif
-            ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
-                + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
             ime_db.module_name = ime_db.pkgid;
+
+            String module_path = String (path) + String ("/lib");
+            String fullpath = module_path + String (SCIM_PATH_DELIM_STRING) + ime_db.module_name + String (".so");
+            struct stat st;
+            if (stat(fullpath.c_str (), &st) < 0) {
+                /* Not found in lib directory of package's root path */
+                ime_db.module_path = String (SCIM_MODULE_PATH) + String (SCIM_PATH_DELIM_STRING) + String (SCIM_BINARY_VERSION)
+                    + String (SCIM_PATH_DELIM_STRING) + String ("Helper");
+            }
+            else {
+                ime_db.module_path = module_path;
+            }
+
             ime_db.is_enabled = 1;
             ime_db.is_preinstalled = 1;
             ime_db.has_option = 1;  // Let's assume the inhouse IME always has an option menu.