Pascal Scripting: PathHasInvalidCharacters

Prototype

function PathHasInvalidCharacters(const S: String; const AllowDriveLetterColon: Boolean): Boolean;

Description

Returns True if the specified string contains characters that are never allowed in paths, or characters and path components that are accepted by the system but might present a security problem (such as '..' and sometimes ':'). Set AllowDriveLetterColon to True when the first character may be a drive letter followed by a colon.

Remarks

Extended-length paths that start with a \\?\ prefix are rejected because the '?' is treated as an invalid character.