convert if/else to lib.optionals

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
ahuston-0 2024-05-20 01:19:21 -04:00 committed by Alice Huston
parent ce9e8d9eaa
commit 9c3330b006

View File

@ -43,10 +43,9 @@
# lsdir :: Path -> String -> [String]
lsdir =
dir:
if (builtins.pathExists (dir)) then
(lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (dir))))
else
[ ];
lib.optionals (builtins.pathExists dir) (
lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (dir)))
);
# return full paths of all files in a directory
#