validateFileExtension

Validates that the file has one of the allowed extensions.

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

Parameters

file
Type: string

File name of the file to be tested.

extensions

Allowed extensions including a leading dot.

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