~c-e-pidcott/maus/devel

« back to all changes in this revision

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

  • Committer: Chris Rogers
  • Date: 2012-10-03 07:19:33 UTC
  • mfrom: (659.1.40 release-candidate)
  • Revision ID: chris.rogers@stfc.ac.uk-20121003071933-kgrhvl1ec6w2jmug
Tags: MAUS-v0.3.3
MAUS-v0.3.3

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
          ++pos;
29
29
          if (fileName[pos] == '{') {
30
30
              ++pos;
 
31
          } else {
 
32
              throw(Squeal(Squeal::recoverable,
 
33
                "Error - environment variable must be written like ${VARIABLE}"+
 
34
                std::string(" in file "+fileName),
 
35
                "STLUtils::ReplaceVariables"));
31
36
          }
32
37
          int end = pos +1;
33
 
          while (fileName[end] != '}') {
 
38
          while (fileName[end] != '}' &&
 
39
                 end < static_cast<int>(fileName.size())) {
34
40
              ++end;
35
41
          }
 
42
          if (end == static_cast<int>(fileName.size())) {
 
43
              throw(Squeal(Squeal::recoverable,
 
44
                "Error - environment variable must be written like ${VARIABLE}"+
 
45
                std::string(" in file "+fileName),
 
46
                "STLUtils::ReplaceVariables"));
 
47
          }
36
48
          std::string variable;
37
49
          for (int vpos = pos; vpos < end; ++vpos) {
38
50
              variable += fileName[vpos];