From d20c3011a06a49d229c92c49447eb21b5a1f110d Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Tue, 3 Oct 2006 14:55:54 +0000 Subject: * toFile: added an additional argument to specify the store path suffix, e.g., `builtins.toFile "builder.sh" "..."'. * toFile: handle references to other files correctly. --- src/libexpr/eval.cc | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) (limited to 'src/libexpr/eval.cc') diff --git a/src/libexpr/eval.cc b/src/libexpr/eval.cc index 416d43b33b7e..fa843b5d3b15 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)) { -- cgit 1.4.1