Mercurial > hg > orthanc
diff Plugins/Engine/OrthancPlugins.cpp @ 1145:0479d02c6778
Plugins can retrieve the path to Orthanc and to its configuration file
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Thu, 11 Sep 2014 13:06:16 +0200 |
parents | d9c27f9f1a51 |
children | 1ea4094d077c |
line wrap: on
line diff
--- a/Plugins/Engine/OrthancPlugins.cpp Thu Sep 11 10:26:32 2014 +0200 +++ b/Plugins/Engine/OrthancPlugins.cpp Thu Sep 11 13:06:16 2014 +0200 @@ -38,6 +38,7 @@ #include "../../Core/HttpServer/HttpOutput.h" #include "../../Core/ImageFormats/PngWriter.h" #include "../../OrthancServer/ServerToolbox.h" +#include "../../OrthancServer/OrthancInitialization.h" #include <boost/regex.hpp> #include <glog/logging.h> @@ -573,8 +574,8 @@ void OrthancPlugins::LookupResource(_OrthancPluginService service, const void* parameters) { - const _OrthancPluginLookupResource& p = - *reinterpret_cast<const _OrthancPluginLookupResource*>(parameters); + const _OrthancPluginRetrieveDynamicString& p = + *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters); /** * The enumeration below only uses the tags that are indexed in @@ -617,7 +618,7 @@ } std::list<std::string> result; - pimpl_->context_.GetIndex().LookupTagValue(result, tag, p.identifier, level); + pimpl_->context_.GetIndex().LookupTagValue(result, tag, p.argument, level); if (result.size() == 1) { @@ -743,10 +744,31 @@ bool OrthancPlugins::InvokeService(_OrthancPluginService service, - const void* parameters) + const void* parameters) { switch (service) { + case _OrthancPluginService_GetOrthancPath: + { + std::string s = Toolbox::GetPathToExecutable(); + *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); + return true; + } + + case _OrthancPluginService_GetOrthancDirectory: + { + std::string s = Toolbox::GetDirectoryOfExecutable(); + *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = CopyString(s); + return true; + } + + case _OrthancPluginService_GetConfigurationPath: + { + *reinterpret_cast<const _OrthancPluginRetrieveDynamicString*>(parameters)->result = + CopyString(Configuration::GetConfigurationAbsolutePath()); + return true; + } + case _OrthancPluginService_RegisterRestCallback: RegisterRestCallback(parameters); return true;