mirror of
https://github.com/NixOS/nix.git
synced 2024-11-25 16:23:02 +00:00
Merge pull request #9084 from NixOS/backport-9079-to-2.17-maintenance
[Backport 2.17-maintenance] [Backport 2.18-maintenance] pathExists: isDir when endswith /.
This commit is contained in:
commit
02d55d44e5
@ -1521,7 +1521,9 @@ static void prim_pathExists(EvalState & state, const PosIdx pos, Value * * args,
|
||||
auto path = realisePath(state, pos, arg, { .checkForPureEval = false });
|
||||
|
||||
/* SourcePath doesn't know about trailing slash. */
|
||||
auto mustBeDir = arg.type() == nString && arg.str().ends_with("/");
|
||||
auto mustBeDir = arg.type() == nString
|
||||
&& (arg.str().ends_with("/")
|
||||
|| arg.str().ends_with("/."));
|
||||
|
||||
try {
|
||||
auto checked = state.checkSourcePath(path);
|
||||
|
@ -2,6 +2,27 @@ builtins.pathExists (./lib.nix)
|
||||
&& builtins.pathExists (builtins.toPath ./lib.nix)
|
||||
&& builtins.pathExists (builtins.toString ./lib.nix)
|
||||
&& !builtins.pathExists (builtins.toString ./lib.nix + "/")
|
||||
&& !builtins.pathExists (builtins.toString ./lib.nix + "/.")
|
||||
# FIXME
|
||||
# && !builtins.pathExists (builtins.toString ./lib.nix + "/..")
|
||||
# && !builtins.pathExists (builtins.toString ./lib.nix + "/a/..")
|
||||
# && !builtins.pathExists (builtins.toString ./lib.nix + "/../lib.nix")
|
||||
&& !builtins.pathExists (builtins.toString ./lib.nix + "/./")
|
||||
&& !builtins.pathExists (builtins.toString ./lib.nix + "/./.")
|
||||
&& builtins.pathExists (builtins.toString ./.. + "/lang/lib.nix")
|
||||
&& !builtins.pathExists (builtins.toString ./.. + "lang/lib.nix")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/lib.nix")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/./lib.nix")
|
||||
&& builtins.pathExists (builtins.toString ./.)
|
||||
&& builtins.pathExists (builtins.toString ./. + "/")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/.")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/./")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang//./")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/..")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/../")
|
||||
&& builtins.pathExists (builtins.toString ./. + "/../lang/..//")
|
||||
&& builtins.pathExists (builtins.toPath (builtins.toString ./lib.nix))
|
||||
&& !builtins.pathExists (builtins.toPath (builtins.toString ./bla.nix))
|
||||
&& builtins.pathExists ./lib.nix
|
||||
|
Loading…
Reference in New Issue
Block a user