[Overview][Constants][Types][Classes][Procedures and functions][Index] Reference for unit 'Masks' (#lazutils)

MatchesWindowsMaskList

Determine whether the specified file name matches at least one of the specified Windows-specific masks.

Declaration

Source position: masks.pas line 391

function MatchesWindowsMaskList(

  const FileName: string;

  const Mask: string;

  Separator: Char = ';';

  CaseSensitive: Boolean = False;

  aOpcodesAllowed: TMaskOpCodes = DefaultMaskOpCodes;

  aWindowsQuirksAllowed: TWindowsQuirks = DefaultWindowsQuirks

):Boolean;

function MatchesWindowsMaskList(

  const FileName: string;

  const Mask: string;

  Separator: Char;

  Options: TMaskOptions

):Boolean;

Arguments

FileName

  

File name compared to the file masks in Mask.

Mask

  

one or more file mask expressions separated by one of the values in Separator.

Separator

  

Character(s) used as a separator between mask expressions in Mask.

CaseSensitive

  

True if the file name to mask comparison is case sensitive.

aOpcodesAllowed

  

Set of TMaskOpCode values allowed in the comparison.

aWindowsQuirksAllowed

  

Set of TWindowsQuirk values allowed in the comparison.

Function result

True when Filename matches at least one of the masks in the list.

Arguments

FileName

  

File name compared to the file masks in Mask.

Mask

  

one or more file mask expressions separated by one of the values in Separator.

Separator

  

Character(s) used as a separator between mask expressions in Mask.

Options

  

TMaskOption values which enable or disable features in the comparison.

Description

MatchesWindowsMaskList is an overloaded Boolean function used to determine whether the specified file name matches at least one of the specified masks. MatchesWindowsMaskList is similar to MatchesMaskList, but provides support for Windows-style file system masks in the Mask argument. This includes use of the following:

foo*.*
Matches all files starting with 'foo' regardless of the file extension. Same as foo* using MatchesMaskList.
foo*.
Matches foo* but must not include a file extension.
*.
Matches any file name, but must not include a file extension.
foo.
Matches foo but not foo.txt.
foo.*
Matches foo, foo.txt, or foo.bar.
*.*
Matches any file name with an extension.

Overloaded variants of the routine provide arguments and configuration settings, including:

Filename
File name compared to the file masks in Mask.
Mask
Contains one or more file mask expressions separated by one of the values in Separator.
Separator
Contains the character(s) used as a separator between mask expressions in Mask. The default separator is the SemiColon (;) character.
Options
Contains TMaskOption values which enable or disable features in the comparison. The default value is an empty set ([]).
CaseSensitive
Indicates whether the file name to mask comparison is case sensitive.
Remark: The overloaded variant which includes the CaseSensitive argument has been deprecated. Use the variant that includes the TMaskOptions argument.

MatchesWindowsMaskList creates a TMaskList instance which uses the values in the Mask, Separator and Options parameters. Its MatchesWindowsMask method is called to compare the value in Filename to the Windows-style masks in the list.

The return value is True when Filename matches at least one of the masks in the list.

Remark: The overloaded variant which includes a TMaskOptions parameter has been marked as deprecated in version 2.3. It will be removed in version 2.5.

See also

Masks Overview

  

Masks Overview.


Version 4.0 Generated 2025-05-03 Home