[iotcon] allow virtual roots in initialize .dat file path 08/94408/1
authorJakub Skowron <j.skowron@samsung.com>
Fri, 28 Oct 2016 16:56:47 +0000 (18:56 +0200)
committerJakub Skowron <j.skowron@samsung.com>
Fri, 28 Oct 2016 16:56:47 +0000 (18:56 +0200)
Convert virtual root (if present in path) for native
iotcon_initialize function.

Change-Id: I048919c19cd4916a06edef766143bcec31709c8a
Signed-off-by: Jakub Skowron <j.skowron@samsung.com>
src/iotcon/iotcon_instance.cc

index 46d618e34e4b7cf665dff490c477038c0b523d2d..2de0b42253164b4d1a5fa8d57f5ed61c841fc756 100644 (file)
@@ -26,6 +26,8 @@
 #include "iotcon/iotcon_server_manager.h"
 #include "iotcon/iotcon_client_manager.h"
 
+#include "common/filesystem/filesystem_provider.h"
+
 namespace extension {
 namespace iotcon {
 
@@ -1580,9 +1582,10 @@ common::TizenResult IotconInstance::Initialize(const picojson::object& args) {
 
   CHECK_EXIST(args, kFilePath);
   const auto& filePath = IotconUtils::GetArg(args, kFilePath);
+  //convert virtual root (if present in path) for native iotcon_initialize function
+  std::string realPath = common::FilesystemProvider::Create().GetRealPath( filePath.get<std::string>() );
 
-  auto result = IotconUtils::ConvertIotconError(
-                  iotcon_initialize(filePath.get<std::string>().c_str()));
+  auto result = IotconUtils::ConvertIotconError( iotcon_initialize(realPath.c_str()) );
   if (!result) {
     LogAndReturnTizenError(result);
   }