lib.filesystem: remove Nix 2.14 shim

It was added in fcaa2b1097. Lix is based off of 2.18, and the minimum version for Nixpkgs has long since incorporated this builtin.
This commit is contained in:
Philip Taron
2025-10-09 12:22:37 -07:00
parent a00546f93e
commit 4f652cfaf4

View File

@@ -56,25 +56,7 @@ in
::: :::
*/ */
pathType = pathType = builtins.readFileType;
builtins.readFileType or
# Nix <2.14 compatibility shim
(
path:
if
!pathExists path
# Fail irrecoverably to mimic the historic behavior of this function and
# the new builtins.readFileType
then
abort "lib.filesystem.pathType: Path ${toString path} does not exist."
# The filesystem root is the only path where `dirOf / == /` and
# `baseNameOf /` is not valid. We can detect this and directly return
# "directory", since we know the filesystem root can't be anything else.
else if dirOf path == path then
"directory"
else
(readDir (dirOf path)).${baseNameOf path}
);
/** /**
Whether a path exists and is a directory. Whether a path exists and is a directory.