convert if/else to lib.optionals

Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
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 :: Path -> String -> [String]
lsdir = lsdir =
dir: dir:
if (builtins.pathExists (dir)) then lib.optionals (builtins.pathExists dir) (
(lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (dir)))) lib.attrNames (lib.filterAttrs (path: type: type == "directory") (builtins.readDir (dir)))
else );
[ ];
# return full paths of all files in a directory # return full paths of all files in a directory
# #