about summary refs log tree commit diff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc12
1 files changed, 11 insertions, 1 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index 22820f2fe8ac..4387c8acc2aa 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -52,7 +52,7 @@ static void readSettings()
         string name, sep, value;
         is >> name >> sep >> value;
         if (sep != "=" || !is)
-            throw Error(format("illegal configuration line `%1%'") % line);
+            throw Error(format("illegal configuration line `%1%' in `%2%'") % line % settingsFile);
         
         settings[name] = value;
     };
@@ -67,3 +67,13 @@ string querySetting(const string & name, const string & def)
     map<string, string>::iterator i = settings.find(name);
     return i == settings.end() ? def : i->second;
 }
+
+
+bool queryBoolSetting(const string & name, bool def)
+{
+    string value = querySetting(name, def ? "true" : "false");
+    if (value == "true") return true;
+    else if (value == "false") return false;
+    else throw Error(format("configuration option `%1%' should be either `true' or `false', not `%2%'")
+        % name % value);
+}