From bf1a5a8258daeef343a85d1b4d7e7df1e67ef7ed Mon Sep 17 00:00:00 2001
From: Pete Peterson <petersonpf@ornl.gov>
Date: Wed, 1 Feb 2017 11:32:18 -0500
Subject: [PATCH] Add config dependent instrument path

---
 Framework/Kernel/src/ConfigService.cpp | 17 ++++++++++++-----
 1 file changed, 12 insertions(+), 5 deletions(-)

diff --git a/Framework/Kernel/src/ConfigService.cpp b/Framework/Kernel/src/ConfigService.cpp
index fa4d4e9779e..99a5a3220a6 100644
--- a/Framework/Kernel/src/ConfigService.cpp
+++ b/Framework/Kernel/src/ConfigService.cpp
@@ -1637,11 +1637,18 @@ const std::string ConfigServiceImpl::getVTPFileDirectory() {
  */
 void ConfigServiceImpl::cacheInstrumentPaths() {
   m_InstrumentDirs.clear();
-  Poco::Path path(getAppDataDir());
-  path.makeDirectory();
-  path.pushDirectory("instrument");
-  std::string appdatadir = path.toString();
-  addDirectoryifExists(appdatadir, m_InstrumentDirs);
+
+  // 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();
+    addDirectoryifExists(appdatadir, m_InstrumentDirs);
+  }
 
 #ifndef _WIN32
   std::string etcdatadir = "/etc/mantid/instrument";
-- 
GitLab