about summary refs log tree commit diff
path: root/src/expr.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/expr.cc')
-rw-r--r--src/expr.cc11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/expr.cc b/src/expr.cc
index 521dffc9c693..cfc4af1f39a8 100644
--- a/src/expr.cc
+++ b/src/expr.cc
@@ -39,14 +39,11 @@ Path writeTerm(ATerm t, const string & suffix)
         (string) h + suffix + ".nix");
 
     if (!isValidPath(path)) {
-        if (!ATwriteToNamedTextFile(t, path.c_str()))
-            throw Error(format("cannot write aterm %1%") % path);
-
-        Transaction txn(nixDB);
-        registerValidPath(txn, path);
-        txn.commit();
+        char * s = ATwriteToString(t);
+        if (!s) throw Error(format("cannot write aterm to `%1%'") % path);
+        addTextToStore(path, string(s));
     }
-
+    
     return path;
 }