From cd973fa07f4939b6f21b7254c795e347d31fce74 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 24 Jan 2020 13:01:07 +0100 Subject: [PATCH] Give a better error message when a flake path is not a directory --- src/libexpr/flake/flakeref.cc | 3 +++ 1 file changed, 3 insertions(+) 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 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;