convert if/else to lib.optionals
Signed-off-by: ahuston-0 <aliceghuston@gmail.com>
This commit is contained in:
parent
ce9e8d9eaa
commit
9c3330b006
@ -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
|
||||
#
|
||||
|
Loading…
x
Reference in New Issue
Block a user