From 46d73c294bd4921e901b7ac330cdd1a19b32961a Mon Sep 17 00:00:00 2001 From: Pete Peterson <petersonpf@ornl.gov> Date: Wed, 1 Feb 2017 14:12:25 -0500 Subject: [PATCH] Documented unnoticed side-effect --- Framework/Kernel/src/ConfigService.cpp | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp index 99a5a3220a6..bb50f52cc13 100644 --- a/Framework/Kernel/src/ConfigService.cpp +++ b/Framework/Kernel/src/ConfigService.cpp @@ -1627,7 +1627,8 @@ const std::string ConfigServiceImpl::getVTPFileDirectory() { return directoryName; } /** - * Fills the internal cache of instrument definition directories + * Fills the internal cache of instrument definition directories and creates + * The %appdata%/mantidproject/mantid or $home/.mantid directory. * * This will normally contain from Index 0 * - The download directory (win %appdata%/mantidproject/mantid/instrument) @@ -1638,21 +1639,21 @@ const std::string ConfigServiceImpl::getVTPFileDirectory() { void ConfigServiceImpl::cacheInstrumentPaths() { m_InstrumentDirs.clear(); + Poco::Path path(getAppDataDir()); + path.makeDirectory(); // making this directory is a necessary side effect + path.pushDirectory("instrument"); + // only use downloaded instruments if configured to download const std::string updateInstrStr = this->getString("UpdateInstrumentDefinitions.OnStartup"); if (updateInstrStr.compare("1") == 0 || updateInstrStr.compare("on") == 0 || updateInstrStr.compare("On") == 0) { - Poco::Path path(getAppDataDir()); - path.makeDirectory(); - path.pushDirectory("instrument"); - std::string appdatadir = path.toString(); + const std::string appdatadir = path.toString(); addDirectoryifExists(appdatadir, m_InstrumentDirs); } #ifndef _WIN32 - std::string etcdatadir = "/etc/mantid/instrument"; - addDirectoryifExists(etcdatadir, m_InstrumentDirs); + addDirectoryifExists("/etc/mantid/instrument", m_InstrumentDirs); #endif // Determine the search directory for XML instrument definition files (IDFs) -- GitLab