about summary refs log tree commit diff
path: root/src/libstore/globals.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-02-16T13·58+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-02-16T13·58+0000
commit345a95afe9e265bc433eea46c32c507ea84a72a4 (patch)
tree742bf5e45e2eeaf00673fe30fe13726531733b56 /src/libstore/globals.cc
parent651ab439cf5b0c6ab2044257a30b0d94406d57d3 (diff)
* Allow the size of the GC reserved file to be specified in nix.conf
  through the new `gc-reserved-space' option.

Diffstat (limited to 'src/libstore/globals.cc')
-rw-r--r--src/libstore/globals.cc19
1 files changed, 12 insertions, 7 deletions
diff --git a/src/libstore/globals.cc b/src/libstore/globals.cc
index a69bc0c30307..fc338892f22d 100644
--- a/src/libstore/globals.cc
+++ b/src/libstore/globals.cc
@@ -75,17 +75,22 @@ Strings querySetting(const string & name, const Strings & def)
 }
 
 
-bool queryBoolSetting(const string & name, bool def)
+string querySetting(const string & name, const string & def)
 {
     Strings defs;
-    if (def) defs.push_back("true"); else defs.push_back("false");
-    
+    defs.push_back(def);
+
     Strings value = querySetting(name, defs);
     if (value.size() != 1)
-        throw Error(format("configuration option `%1%' should be either `true' or `false', not a list")
-            % name);
-    
-    string v = value.front();
+        throw Error(format("configuration option `%1%' should not be a list") % name);
+
+    return value.front();
+}
+
+
+bool queryBoolSetting(const string & name, bool def)
+{
+    string v = querySetting(name, def ? "true" : "false");
     if (v == "true") return true;
     else if (v == "false") return false;
     else throw Error(format("configuration option `%1%' should be either `true' or `false', not `%2%'")