Skip to content

Commit 2b706b2

Browse files
committed
avoid empty entries. an empty value means: clear it
1 parent 5b8cd66 commit 2b706b2

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

src/Configuration.cxx

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
#include <stdexcept>
3636
#include <iostream>
3737
#include "ticcutils/StringOps.h"
38+
#include "ticcutils/PrettyPrint.h"
3839

3940
using namespace std;
4041

@@ -115,7 +116,12 @@ namespace TiCC {
115116
val = val.substr(1, val.length()-2);
116117
}
117118
val = fixControls( val );
118-
myMap[section][att] = val;
119+
if ( val.size() == 0 ){
120+
myMap[section].erase(att);
121+
}
122+
else {
123+
myMap[section][att] = val;
124+
}
119125
return true;
120126
}
121127
return false;
@@ -139,8 +145,9 @@ namespace TiCC {
139145
else {
140146
cdir += "/";
141147
}
142-
// cerr << "dirname= " << cdir << endl;
143-
myMap["global"]["configDir"] = cdir; // can be overidden below
148+
if ( !cdir.empty() ){
149+
myMap["global"]["configDir"] = cdir; // can be overidden below
150+
}
144151
string inLine;
145152
string section = "global";
146153
while ( getline( is, inLine ) ){

0 commit comments

Comments
 (0)