about summary refs log tree commit diff
path: root/src/libexpr/eval.cc
diff options
context:
space:
mode:
authorEelco Dolstra <e.dolstra@tudelft.nl>2006-10-03T14·55+0000
committerEelco Dolstra <e.dolstra@tudelft.nl>2006-10-03T14·55+0000
commitd20c3011a06a49d229c92c49447eb21b5a1f110d (patch)
treee1850df03fe0f5fdd4f956949f9219b67b20b75b /src/libexpr/eval.cc
parent84e6c43e85cab83ee033bf13c1e58c0f30ca1de9 (diff)
* toFile: added an additional argument to specify the store path
  suffix, e.g., `builtins.toFile "builder.sh" "..."'.
* toFile: handle references to other files correctly.

Diffstat (limited to 'src/libexpr/eval.cc')
-rw-r--r--src/libexpr/eval.cc7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc
index 416d43b33b..fa843b5d3b 100644
--- a/src/libexpr/eval.cc
+++ b/src/libexpr/eval.cc
@@ -2,6 +2,7 @@
 #include "parser.hh"
 #include "hash.hh"
 #include "util.hh"
+#include "store.hh"
 #include "nixexpr-ast.hh"
 
 
@@ -256,7 +257,11 @@ string coerceToStringWithContext(EvalState & state,
     
     if (matchPath(e, s)) {
         isPath = true;
-        return aterm2String(s);
+        Path path = aterm2String(s);
+        if (isInStore(path)) {
+            context = ATinsert(context, makePath(toATerm(toStorePath(path))));
+        }
+        return path;
     }
 
     if (matchAttrs(e, es)) {