aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2019-08-08 15:49:13 +0200
committerEelco Dolstra <edolstra@gmail.com>2019-08-08 15:49:13 +0200
commit1d750e058738f92b378a6bfbdadb025d1463c243 (patch)
tree798ac85630df11dac35884c7c6c5bdd6be376bea /src/libexpr
parent336afe4d5fe374569c2b13d2db90caac663573b3 (diff)
parent05a10dd835923092b54fcad2276d54bf164c1b7f (diff)
Merge remote-tracking branch 'origin/master' into flakes
Diffstat (limited to 'src/libexpr')
-rw-r--r--src/libexpr/primops.cc10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/libexpr/primops.cc b/src/libexpr/primops.cc
index 10ce1abf5..32ce00bbc 100644
--- a/src/libexpr/primops.cc
+++ b/src/libexpr/primops.cc
@@ -832,8 +832,14 @@ static void prim_pathExists(EvalState & state, const Pos & pos, Value * * args,
{
PathSet context;
Path path = state.coerceToPath(pos, *args[0], context);
- if (!context.empty())
- throw EvalError(format("string '%1%' cannot refer to other paths, at %2%") % path % pos);
+ try {
+ state.realiseContext(context);
+ } catch (InvalidPathError & e) {
+ throw EvalError(format(
+ "cannot check the existence of '%1%', since path '%2%' is not valid, at %3%")
+ % path % e.path % pos);
+ }
+
try {
mkBool(v, pathExists(state.checkSourcePath(path)));
} catch (SysError & e) {