aboutsummaryrefslogtreecommitdiff
path: root/src/nix/eval.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/nix/eval.cc')
-rw-r--r--src/nix/eval.cc14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nix/eval.cc b/src/nix/eval.cc
index 81474c2d3..967dc8519 100644
--- a/src/nix/eval.cc
+++ b/src/nix/eval.cc
@@ -88,17 +88,19 @@ struct CmdEval : MixJSON, InstallableCommand
else if (v.type() == nAttrs) {
if (mkdir(path.c_str(), 0777) == -1)
throw SysError("creating directory '%s'", path);
- for (auto & attr : *v.attrs)
+ for (auto & attr : *v.attrs) {
+ std::string_view name = state->symbols[attr.name];
try {
- if (attr.name == "." || attr.name == "..")
- throw Error("invalid file name '%s'", attr.name);
- recurse(*attr.value, attr.pos, path + "/" + std::string(attr.name));
+ if (name == "." || name == "..")
+ throw Error("invalid file name '%s'", name);
+ recurse(*attr.value, attr.pos, concatStrings(path, "/", name));
} catch (Error & e) {
e.addTrace(
state->positions[attr.pos],
- hintfmt("while evaluating the attribute '%s'", attr.name));
+ hintfmt("while evaluating the attribute '%s'", name));
throw;
}
+ }
}
else
throw TypeError("value at '%s' is not a string or an attribute set", state->positions[pos]);
@@ -119,7 +121,7 @@ struct CmdEval : MixJSON, InstallableCommand
else {
state->forceValueDeep(*v);
- logger->cout("%s", *v);
+ logger->cout("%s", printValue(*state, *v));
}
}
};