-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New builtin: pathType #3096
Copy link
Copy link
Closed
Labels
featureFeature request or proposalFeature request or proposallanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcThe Nix expression language; parser, interpreter, primops, evaluation, etcstale
Metadata
Metadata
Assignees
Labels
featureFeature request or proposalFeature request or proposallanguageThe Nix expression language; parser, interpreter, primops, evaluation, etcThe Nix expression language; parser, interpreter, primops, evaluation, etcstale
Fields
Give feedbackNo fields configured for issues without a type.
I'm proposing to add a new
builtins.pathTypethat returns the node type, similar to the values returned bybuiltins.readDir.Motivation
Avoid having to read a directory when all you need is a single path's node type.
Spec
Like
builtins.pathExists, its argument is a path or string that may or may not exist on the filesystem.Given argument
preturn value isnullwhen the pathpdoes not point to an existing filesystem node(builtins.readDir (dirOf p))."$(baseNameOf p)", such as "directory", "regular", "symlink"Advantages
/nix/store)readDir (dirOf p)may not be allowed by dir permissionslorri