about summary refs log tree commit diff
diff options
context:
space:
mode:
authorShea Levy <shea@shealevy.com>2012-08-29T02·12-0400
committerEelco Dolstra <eelco.dolstra@logicblox.com>2012-10-23T14·39+0200
commit2980d1fba97069805c3649c5d99d0356bce6c303 (patch)
treea160c0e17b8080453ce82e40a3925e6cf62c1233
parentdde6486eabbabf83e2d7aa65cde8eadfee108bdd (diff)
prim_toPath: Actually make the string a path
-rw-r--r--src/libexpr/primops.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 509297003f6e..409e6256b52f 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -517,7 +517,9 @@ static void prim_toPath(EvalState & state, Value * * args, Value & v)
 {
     PathSet context;
     Path path = state.coerceToPath(*args[0], context);
-    mkString(v, canonPath(path), context);
+    if (!context.empty())
+        throw EvalError(format("string `%1%' cannot refer to other paths") % path);
+    mkPath(v, canonPath(path).c_str());
 }