diff OrthancServer/main.cpp @ 394:9784f19f7e1b lua-scripting

path relative to configuration path, list of lua scripts
author Sebastien Jodogne <s.jodogne@gmail.com>
date Thu, 02 May 2013 11:02:15 +0200
parents 7035f4a5b07b
children 941ea46e9e26
line wrap: on
line diff
--- a/OrthancServer/main.cpp	Tue Apr 30 15:41:07 2013 +0200
+++ b/OrthancServer/main.cpp	Thu May 02 11:02:15 2013 +0200
@@ -222,8 +222,10 @@
       OrthancInitialize();
     }
 
-    boost::filesystem::path storageDirectory = GetGlobalStringParameter("StorageDirectory", "OrthancStorage");
-    boost::filesystem::path indexDirectory = GetGlobalStringParameter("IndexDirectory", storageDirectory.string());
+    boost::filesystem::path storageDirectory = 
+      InterpretStringParameterAsPath(GetGlobalStringParameter("StorageDirectory", "OrthancStorage"));
+    boost::filesystem::path indexDirectory = 
+      InterpretStringParameterAsPath(GetGlobalStringParameter("IndexDirectory", storageDirectory.string()));
     ServerContext context(storageDirectory, indexDirectory);
 
     LOG(WARNING) << "Storage directory: " << storageDirectory;
@@ -231,16 +233,16 @@
 
     context.SetCompressionEnabled(GetGlobalBoolParameter("StorageCompression", false));
 
+    std::list<std::string> luaScripts;
+    GetGlobalListOfStringsParameter(luaScripts, "LuaScripts");
+    for (std::list<std::string>::const_iterator
+           it = luaScripts.begin(); it != luaScripts.end(); it++)
     {
-      std::string path = GetGlobalStringParameter("Scripting", "");
-      if (path.size() > 0)
-      {
-        LOG(WARNING) << "Installing the Lua scripts from: " << path;
-        std::string lua;
-        Toolbox::ReadFile(lua, path);
-        context.GetLuaContext().Execute(Orthanc::EmbeddedResources::LUA_TOOLBOX);
-        context.GetLuaContext().Execute(lua);
-      }
+      std::string path = InterpretStringParameterAsPath(*it);
+      LOG(WARNING) << "Installing the Lua scripts from: " << path;
+      std::string script;
+      Toolbox::ReadFile(script, path);
+      context.GetLuaContext().Execute(script);
     }
 
 
@@ -283,7 +285,8 @@
 
       if (GetGlobalBoolParameter("SslEnabled", false))
       {
-        std::string certificate = GetGlobalStringParameter("SslCertificate", "certificate.pem");
+        std::string certificate = 
+          InterpretStringParameterAsPath(GetGlobalStringParameter("SslCertificate", "certificate.pem"));
         httpServer.SetSslEnabled(true);
         httpServer.SetSslCertificate(certificate.c_str());
       }