aboutsummaryrefslogtreecommitdiff
path: root/src/libexpr/flake/flakeref.cc
diff options
context:
space:
mode:
authorEelco Dolstra <edolstra@gmail.com>2020-01-24 13:01:07 +0100
committerEelco Dolstra <edolstra@gmail.com>2020-01-24 13:01:34 +0100
commitcd973fa07f4939b6f21b7254c795e347d31fce74 (patch)
tree9ff913faaed6ef55e30cbfb1788aef88be0fb25e /src/libexpr/flake/flakeref.cc
parentb430a81a1fbf6c792ba49e3aefe46256263430e5 (diff)
Give a better error message when a flake path is not a directory
Diffstat (limited to 'src/libexpr/flake/flakeref.cc')
-rw-r--r--src/libexpr/flake/flakeref.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/libexpr/flake/flakeref.cc b/src/libexpr/flake/flakeref.cc
index 397b1b84b..3ebaada15 100644
--- a/src/libexpr/flake/flakeref.cc
+++ b/src/libexpr/flake/flakeref.cc
@@ -111,6 +111,9 @@ std::pair<FlakeRef, std::string> parseFlakeRefWithFragment(
throw BadURL("flake reference '%s' is not an absolute path", url);
path = absPath(path, baseDir, true);
+ if (!S_ISDIR(lstat(path).st_mode))
+ throw BadURL("path '%s' is not a flake (because it's not a directory)", path);
+
auto flakeRoot = path;
std::string subdir;