From ae0779d106c89b911722f43b5afa65d0f1b282ec Mon Sep 17 00:00:00 2001 From: Peter Peterson <petersonpf@ornl.gov> Date: Wed, 1 Jun 2011 19:50:40 +0000 Subject: [PATCH] Adding local config file. Fixes #3123. --- .../Kernel/inc/MantidKernel/ConfigService.h | 2 ++ .../Framework/Kernel/src/ConfigService.cpp | 17 ++++++++++++++++- 2 files changed, 18 insertions(+), 1 deletion(-) diff --git a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h index 0fb86714ff2..cce37d20644 100644 --- a/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h +++ b/Code/Mantid/Framework/Kernel/inc/MantidKernel/ConfigService.h @@ -123,6 +123,8 @@ namespace Mantid // Searches for a configuration property and returns its value template<typename T> int getValue(const std::string& keyName, T& out); + /// Return the local properties filename. + std::string getLocalFilename() const; /// Return the user properties filename std::string getUserFilename() const; diff --git a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp index fd506445a5a..133f7e9393a 100644 --- a/Code/Mantid/Framework/Kernel/src/ConfigService.cpp +++ b/Code/Mantid/Framework/Kernel/src/ConfigService.cpp @@ -179,6 +179,8 @@ ConfigServiceImpl::ConfigServiceImpl() : updateConfig(getPropertiesDir() + m_properties_file_name, false, false); propertiesFilesList = getPropertiesDir() + m_properties_file_name; + updateConfig(getLocalFilename(), true, false); + if (Poco::Environment::has("MANTIDPROPERTIES")) { //and then append the user properties @@ -866,9 +868,22 @@ int ConfigServiceImpl::getValue(const std::string& keyName, T& out) return result; } +/** + * Return the full filename of the local properties file. + * @returns A string containing the full path to the local file. + */ +std::string ConfigServiceImpl::getLocalFilename() const +{ +#ifdef _WIN32 + return ""; +#else + return "/etc/mantid.local.properties"; +#endif +} + /** * Return the full filename of the user properties file - * @returns A string containg the full path to the user file + * @returns A string containing the full path to the user file */ std::string ConfigServiceImpl::getUserFilename() const { -- GitLab