maybeMissing
lib.fileset.maybeMissing
Docs pulled from | This Revision | 43 minutes ago
Create a file set from a path that may or may not exist:
- If the path does exist, the path is coerced to a file set.
- If the path does not exist, a file set containing no files is returned.
Inputs
path
-
1. Function argument
Type
maybeMissing :: Path -> FileSet
Examples
lib.fileset.maybeMissing
usage example
# All files in the current directory, but excluding main.o if it exists
difference ./. (maybeMissing ./main.o)
Noogle detected
Implementation
The following is the current implementation of this function.
maybeMissing =
path:
if !isPath path then
if isStringLike path then
throw ''lib.fileset.maybeMissing: Argument ("${toString path}") is a string-like value, but it should be a path instead.''
else
throw ''lib.fileset.maybeMissing: Argument is of type ${typeOf path}, but it should be a path instead.''
else if !pathExists path then
_emptyWithoutBase
else
_singleton path;