about summary refs log tree commit diff
path: root/src/libstore/build.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2017-04-13T13·55+0200
committerEelco Dolstra <edolstra@gmail.com>2017-04-13T14·03+0200
commit2040240e238a41c2eb799bf4dbf394fec297ac16 (patch)
tree73661117f25db0f21cf7497ad43c6cb2766a7a05 /src/libstore/build.cc
parent568a099c889e7ccc5a49b15575078e99acf8bc2f (diff)
Add a Config class to simplify adding configuration settings
The typical use is to inherit Config and add Setting<T> members:

  class MyClass : private Config
  {
    Setting<int> foo{this, 123, "foo", "the number of foos to use"};
    Setting<std::string> bar{this, "blabla", "bar", "the name of the bar"};

    MyClass() : Config(readConfigFile("/etc/my-app.conf"))
    {
      std::cout << foo << "\n"; // will print 123 unless overriden
    }
  };

Currently, this is used by Store and its subclasses for store
parameters. You now get a warning if you specify a non-existant store
parameter in a store URI.
Diffstat (limited to 'src/libstore/build.cc')
-rw-r--r--src/libstore/build.cc8
1 files changed, 3 insertions, 5 deletions
diff --git a/src/libstore/build.cc b/src/libstore/build.cc
index 968e291129f3..d9c299d099b7 100644
--- a/src/libstore/build.cc
+++ b/src/libstore/build.cc
@@ -3051,13 +3051,11 @@ Path DerivationGoal::openLogFile()
     string baseName = baseNameOf(drvPath);
 
     /* Create a log file. */
-    Path dir = (format("%1%/%2%/%3%/") % worker.store.logDir % worker.store.drvsLogDir % string(baseName, 0, 2)).str();
+    Path dir = fmt("%s/%s/%s/", worker.store.logDir, worker.store.drvsLogDir, string(baseName, 0, 2));
     createDirs(dir);
 
-    Path logFileName = (format("%1%/%2%%3%")
-        % dir
-        % string(baseName, 2)
-        % (settings.compressLog ? ".bz2" : "")).str();
+    Path logFileName = fmt("%s/%s%s", dir, string(baseName, 2),
+        settings.compressLog ? ".bz2" : "");
 
     fdLogFile = open(logFileName.c_str(), O_CREAT | O_WRONLY | O_TRUNC | O_CLOEXEC, 0666);
     if (!fdLogFile) throw SysError(format("creating log file ‘%1%’") % logFileName);