~mbogomilov/maus/devel3

« back to all changes in this revision

Viewing changes to src/legacy/Interface/STLUtils.cc

  • Committer: Durga Rajaram
  • Date: 2014-01-14 07:07:02 UTC
  • mfrom: (659.1.80 relcand)
  • Revision ID: durga@fnal.gov-20140114070702-2l1fuj1w6rraw7xe
Tags: MAUS-v0.7.6
MAUS-v0.7.6

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 */
18
18
 
19
19
#include "Interface/STLUtils.hh"
20
 
#include "Interface/Squeal.hh"
 
20
#include "Utils/Exception.hh"
21
21
 
22
22
std::string STLUtils::ReplaceVariables(std::string fileName) {
23
23
  unsigned int pos = 0;
29
29
          if (fileName[pos] == '{') {
30
30
              ++pos;
31
31
          } else {
32
 
              throw(Squeal(Squeal::recoverable,
 
32
              throw(MAUS::Exception(MAUS::Exception::recoverable,
33
33
                "Error - environment variable must be written like ${VARIABLE}"+
34
34
                std::string(" in file "+fileName),
35
35
                "STLUtils::ReplaceVariables"));
40
40
              ++end;
41
41
          }
42
42
          if (end == static_cast<int>(fileName.size())) {
43
 
              throw(Squeal(Squeal::recoverable,
 
43
              throw(MAUS::Exception(MAUS::Exception::recoverable,
44
44
                "Error - environment variable must be written like ${VARIABLE}"+
45
45
                std::string(" in file "+fileName),
46
46
                "STLUtils::ReplaceVariables"));
50
50
              variable += fileName[vpos];
51
51
          }
52
52
          if (getenv(variable.c_str()) == NULL) {
53
 
              throw(Squeal(Squeal::recoverable,
 
53
              throw(MAUS::Exception(MAUS::Exception::recoverable,
54
54
                    "Error - "+variable+" environment variable was not defined",
55
55
                    "STLUtils::ReplaceVariables"));
56
56
          }