From fb7f76152f2c0a0c9f91eb54d550ab03d86631a5 Mon Sep 17 00:00:00 2001
From: Whitney Armstrong <warmstrong@anl.gov>
Date: Mon, 10 Dec 2018 21:37:19 -0600
Subject: [PATCH] Added default DB_DIR

- added default DB_DIR
- Fixed Scandalizer due to change in codaversion -> dataversion
---
 src/Scandalizer.cxx |  4 ++--
 src/main.C          | 14 ++++++++++++++
 2 files changed, 16 insertions(+), 2 deletions(-)

diff --git a/src/Scandalizer.cxx b/src/Scandalizer.cxx
index 9d802a4..df88dca 100644
--- a/src/Scandalizer.cxx
+++ b/src/Scandalizer.cxx
@@ -23,9 +23,9 @@ Int_t Scandalizer::ReadOneEvent()
 
   // there may be a better place to do this, but this works
   if (fWantCodaVers > 0) {
-    fEvData->SetCodaVersion(fWantCodaVers);
+    fEvData->SetDataVersion(fWantCodaVers);
   } else {
-    fEvData->SetCodaVersion(fRun->GetCodaVersion());
+    fEvData->SetDataVersion(fRun->GetDataVersion());
   }
 
   switch( status ) {
diff --git a/src/main.C b/src/main.C
index 2c82d91..329c92e 100644
--- a/src/main.C
+++ b/src/main.C
@@ -7,12 +7,26 @@
 #include "THcInterface.h"
 #include <iostream>
 #include <cstring>
+#include <string>
+#include <cstdlib>
 
 using namespace std;
 
 int main(int argc, char **argv)
 {
   // Create a ROOT-style interactive interface
+  //
+
+  if (const char* env_p = std::getenv("DB_DIR")) {
+    std::cout << "Your DB_DIR is: " << env_p << '\n';
+  } else {
+    std::string db_dir_env = "DBASE";
+    if (setenv("DB_DIR", db_dir_env.c_str(), 1)) {
+      std::cout << "Failed to set env var DB_DIR\n";
+      std::exit(EXIT_FAILURE);
+    }
+    std::cout << "DB_DIR set to DBASE\n";
+  }
 
   // Handle convenience command line options
   bool print_version = false, no_logo = false;
-- 
GitLab