diff Plugins/Engine/SharedLibrary.cpp @ 1630:ffd23c0104af

"/system" URI gives information about the plugins used for storage area and DB back-end
author Sebastien Jodogne <s.jodogne@gmail.com>
date Mon, 21 Sep 2015 13:26:45 +0200
parents c17b1142caab
children 0d074f5f6069
line wrap: on
line diff
--- a/Plugins/Engine/SharedLibrary.cpp	Fri Sep 18 17:45:59 2015 +0200
+++ b/Plugins/Engine/SharedLibrary.cpp	Mon Sep 21 13:26:45 2015 +0200
@@ -36,6 +36,8 @@
 #include "../../Core/Logging.h"
 #include "../../Core/Toolbox.h"
 
+#include <boost/filesystem.hpp>
+
 #if defined(_WIN32)
 #include <windows.h>
 #elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
@@ -46,20 +48,20 @@
 
 namespace Orthanc
 {
-  SharedLibrary::SharedLibrary(const std::string& path) : 
-    path_(path),
-    handle_(NULL)
+  SharedLibrary::SharedLibrary(const std::string& path) : handle_(NULL)
   {
+    path_ = boost::filesystem::canonical(path).string();
+
 #if defined(_WIN32)
-    handle_ = ::LoadLibraryA(path.c_str());
+    handle_ = ::LoadLibraryA(path_.c_str());
     if (handle_ == NULL)
     {
-      LOG(ERROR) << "LoadLibrary(" << path << ") failed: Error " << ::GetLastError();
+      LOG(ERROR) << "LoadLibrary(" << path_ << ") failed: Error " << ::GetLastError();
       throw OrthancException(ErrorCode_SharedLibrary);
     }
 
 #elif defined(__linux) || (defined(__APPLE__) && defined(__MACH__)) || defined(__FreeBSD_kernel__) || defined(__FreeBSD__)
-    handle_ = ::dlopen(path.c_str(), RTLD_NOW);
+    handle_ = ::dlopen(path_.c_str(), RTLD_NOW);
     if (handle_ == NULL) 
     {
       std::string explanation;
@@ -69,7 +71,7 @@
         explanation = ": Error " + std::string(tmp);
       }
 
-      LOG(ERROR) << "dlopen(" << path << ") failed" << explanation;
+      LOG(ERROR) << "dlopen(" << path_ << ") failed" << explanation;
       throw OrthancException(ErrorCode_SharedLibrary);
     }