Mercurial > hg > orthanc
diff OrthancServer/OrthancInitialization.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 | 871c49c9b11d |
children | b9e2ed59cae4 |
line wrap: on
line diff
--- a/OrthancServer/OrthancInitialization.cpp Thu Sep 11 10:26:32 2014 +0200 +++ b/OrthancServer/OrthancInitialization.cpp Thu Sep 11 13:06:16 2014 +0200 @@ -61,6 +61,7 @@ static boost::mutex globalMutex_; static std::auto_ptr<Json::Value> configuration_; static boost::filesystem::path defaultDirectory_; + static std::string configurationAbsolutePath_; static void ReadGlobalConfiguration(const char* configurationFile) @@ -74,6 +75,7 @@ Toolbox::ReadFile(content, configurationFile); defaultDirectory_ = boost::filesystem::path(configurationFile).parent_path(); LOG(WARNING) << "Using the configuration from: " << configurationFile; + configurationAbsolutePath_ = boost::filesystem::absolute(configurationFile).string(); } else { @@ -93,6 +95,7 @@ p /= "Configuration.json"; Toolbox::ReadFile(content, p.string()); LOG(WARNING) << "Using the configuration from: " << p.string(); + configurationAbsolutePath_ = boost::filesystem::absolute(p).string(); } catch (OrthancException&) { @@ -103,6 +106,7 @@ #endif } + Json::Reader reader; if (!reader.parse(content, *configuration_)) { @@ -643,4 +647,11 @@ peers.removeMember(symbolicName.c_str()); } + + + + const std::string& Configuration::GetConfigurationAbsolutePath() + { + return configurationAbsolutePath_; + } }