Imported Upstream version 0.9.2
[platform/upstream/iotivity.git] / service / protocol-plugin / plugin-manager / src / PluginManager.cpp
index 43b41a8..16a861b 100644 (file)
 
 
 #include "PluginManager.h"
+#ifdef __TIZEN__
+#include <appfw/app_common.h>
+#endif
 
 using namespace OIC;
 
 PluginManager::PluginManager()
 {
-/**
- * For Tizen Platform, specifiy the absolute location of dynamic library. It is required for
- * Tizen 2.3 EFL App to work.
- */
 #ifdef __TIZEN__
-    handle = dlopen("/opt/usr/apps/org.iotivity.service.ppm.ppmsampleapp/lib/libpmimpl.so",
-                                                                                        RTLD_LAZY);
+    char *app_id = NULL;
+    std::string completePath = "";
+    int res = app_get_id(&app_id);
+    if (APP_ERROR_NONE == res)
+    {
+        completePath = "/opt/usr/apps/";
+        completePath += app_id;
+        completePath += "/lib/libpmimpl.so";
+    }
+    free(app_id);
+    app_id = NULL;
+    handle = dlopen(completePath.c_str(), RTLD_LAZY);
 #else
     handle = dlopen("./libpmimpl.so", RTLD_LAZY);
 #endif //#ifdef __TIZEN__
@@ -80,4 +89,4 @@ std::vector<Plugin> PluginManager::getPlugins(void)
 std::string PluginManager::getState(const std::string plugID)
 {
     return pluginManagerImpl->getState(plugID);
-}
\ No newline at end of file
+}