mirror of
https://github.com/NixOS/nixpkgs.git
synced 2025-07-13 21:50:33 +03:00
lib.filesystem.pathType: Improve error for non-existent paths
Previously it would fail with error: attribute 'nonexistent' missing at nixpkgs/lib/filesystem.nix:29:10: 28| if dirOf path == path then "directory" 29| else (readDir (dirOf path)).${baseNameOf path}; | ^ 30|
This commit is contained in:
parent
bb6eab0bdb
commit
d064d972f0
2 changed files with 6 additions and 1 deletions
|
@ -51,6 +51,7 @@ checkPathType "$PWD/directory" '"directory"'
|
|||
checkPathType "$PWD/regular" '"regular"'
|
||||
checkPathType "$PWD/symlink" '"symlink"'
|
||||
checkPathType "$PWD/fifo" '"unknown"'
|
||||
checkPathType "$PWD/non-existent" "error: evaluation aborted with the following error message: 'lib.filesystem.pathType: Path $PWD/non-existent does not exist.'"
|
||||
|
||||
checkPathIsDirectory() {
|
||||
local path=$1
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue