diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/libexpr/primops.cc | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc index 5892fe3b1..36a67a39d 100644 --- a/src/libexpr/primops.cc +++ b/src/libexpr/primops.cc @@ -1799,15 +1799,16 @@ static void prim_toFile(EvalState & state, const PosIdx pos, Value * * args, Val refs.insert(state.store->parseStorePath(path)); } - auto storePath = state.store->printStorePath(settings.readOnlyMode + auto storePath = settings.readOnlyMode ? state.store->computeStorePathForText(name, contents, refs) - : state.store->addTextToStore(name, contents, refs, state.repair)); + : state.store->addTextToStore(name, contents, refs, state.repair); /* Note: we don't need to add `context' to the context of the result, since `storePath' itself has references to the paths used in args[1]. */ - v.mkString(storePath, {storePath}); + /* Add the output of this to the allowed paths. */ + state.allowAndSetStorePathString(storePath, v); } static RegisterPrimOp primop_toFile({ |