changeset 24:61ffefbc1632

upgrade
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 26 Jun 2015 16:41:39 +0200
parents 574d910a57f0
children c1223564bc80 56a4d23ab688
files CMakeLists.txt Core/Configuration.cpp
diffstat 2 files changed, 15 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/CMakeLists.txt	Fri May 29 11:05:18 2015 +0200
+++ b/CMakeLists.txt	Fri Jun 26 16:41:39 2015 +0200
@@ -55,9 +55,10 @@
 # Check that the Orthanc SDK headers are available or download them
 set(AUTOGENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}/AUTOGENERATED)
 if (STATIC_BUILD)
-  set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.8.6")
+  set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg")
+  #set(ORTHANC_SDK_URL "http://orthanc.googlecode.com/hg-history/Orthanc-0.8.6")
   file(MAKE_DIRECTORY ${AUTOGENERATED_DIR}/orthanc)
-  file(DOWNLOAD "${ORTHANC_SDK_URL}/Plugins/Include/OrthancCPlugin.h"
+  file(DOWNLOAD "${ORTHANC_SDK_URL}/Plugins/Include/orthanc/OrthancCPlugin.h"
     "${AUTOGENERATED_DIR}/orthanc/OrthancCPlugin.h" SHOW_PROGRESS)
   if (${MSVC})
     add_definitions(-D_CRT_SECURE_NO_WARNINGS=1)
--- a/Core/Configuration.cpp	Fri May 29 11:05:18 2015 +0200
+++ b/Core/Configuration.cpp	Fri Jun 26 16:41:39 2015 +0200
@@ -32,33 +32,30 @@
     bool Read(Json::Value& configuration,
               OrthancPluginContext* context)
     {
-      std::string path;
+      std::string s;
 
       {
-        char* pathTmp = OrthancPluginGetConfigurationPath(context);
-        if (pathTmp == NULL)
+        char* tmp = OrthancPluginGetConfiguration(context);
+        if (tmp == NULL)
         {
-          OrthancPluginLogError(context, "No configuration file is provided");
+          OrthancPluginLogError(context, "Error while retrieving the configuration from Orthanc");
           return false;
         }
 
-        path = std::string(pathTmp);
-
-        OrthancPluginFreeString(context, pathTmp);
+        s.assign(tmp);
+        OrthancPluginFreeString(context, tmp);      
       }
 
-      std::ifstream f(path.c_str());
-
       Json::Reader reader;
-      if (!reader.parse(f, configuration) ||
-          configuration.type() != Json::objectValue)
+      if (reader.parse(s, configuration))
       {
-        std::string s = "Unable to parse the configuration file: " + std::string(path);
-        OrthancPluginLogError(context, s.c_str());
+        return true;
+      }
+      else
+      {
+        OrthancPluginLogError(context, "Unable to parse the configuration");
         return false;
       }
-
-      return true;
     }