{
This code can be used to test if the given filename matches with a
list of wildcards search.
examples of use :
isFileFromDefinition('c:\pictures\vanessa.jpg','*.gif;*.jpg;*.tga;*.bmp');
ifFileFromDefinition('c:\pictures\vanessa.jpg','v*.jp?');
}
uses SysUtils, Masks; // works only from Delphi 5 and above
function isFileFromDefinition(aFilename, aMaskList: string): Boolean; var Definition: string; begin aFilename := ExtractFileName(aFilename);
Definition := ''; repeat
if Pos(';', aMaskList) > 0 then Definition := Copy(aMaskList, 1,Pos(';', aMaskList) - 1) else Definition := aMaskList;
Delete(aMaskList, 1,Length(Definition) + 1); if MatchesMask(aFileName, Definition) then
begin Result := True;
Exit; end; until Length(aMaskList) = 0;
Result := False; end;