validateFileExtension

Validates that the file has one of the allowed extensions.

void
validateFileExtension
(
extensions...
)
(
in string file
,
lazy string msg = "invalid file extension: expected one of %-(%s, %) but got %s"
)
if (
allSatisfy!(isSomeString, staticMap!(typeOf, extensions))
)

Parameters

extensions

Allowed extensions including a leading dot.

file string

File name of the file to be tested.

msg string

Error details in case of failure

Throws

darg_plus.exception.ValidationError if the extension of file is not in the list of allowed extensions.

See Also

validate, std.algorithm.searching.endsWith

Meta