codetools: FilenameIsMatching: fixed asterisk in brackets

git-svn-id: trunk@24966 -
This commit is contained in:
mattias 2010-04-26 13:33:30 +00:00
parent a66aa3f7cb
commit 4db8628bf5
2 changed files with 9 additions and 9 deletions

View File

@ -605,22 +605,22 @@ function GatherFiles(Directory, ExcludeDirMask, IncludeFileMask: string): TStrin
ShortFilename: String; ShortFilename: String;
Filename: String; Filename: String;
begin begin
DebugLn(['Search CurDir=',CurDir]); //DebugLn(['Search CurDir=',CurDir]);
if FindFirstUTF8(CurDir+FileMask,faAnyFile,FileInfo)=0 then begin if FindFirstUTF8(CurDir+FileMask,faAnyFile,FileInfo)=0 then begin
repeat repeat
ShortFilename:=FileInfo.Name; ShortFilename:=FileInfo.Name;
if (ShortFilename='') or (ShortFilename='.') or (ShortFilename='..') then if (ShortFilename='') or (ShortFilename='.') or (ShortFilename='..') then
continue; continue;
debugln(['Search ShortFilename=',ShortFilename,' IsDir=',(FileInfo.Attr and faDirectory)>0]); //debugln(['Search ShortFilename=',ShortFilename,' IsDir=',(FileInfo.Attr and faDirectory)>0]);
Filename:=CurDir+ShortFilename; Filename:=CurDir+ShortFilename;
if (FileInfo.Attr and faDirectory)>0 then begin if (FileInfo.Attr and faDirectory)>0 then begin
// directory // directory
if (ExcludeDirMask='') if (ExcludeDirMask='')
or (FilenameIsMatching(ExcludeDirMask,ShortFilename,true)) or (not FilenameIsMatching(ExcludeDirMask,ShortFilename,true))
then begin then begin
Search(Filename+PathDelim); Search(Filename+PathDelim);
end else begin end else begin
DebugLn(['Search DIR MISMATCH ',Filename]); //DebugLn(['Search DIR MISMATCH ',Filename]);
end; end;
end else begin end else begin
// file // file
@ -629,7 +629,7 @@ function GatherFiles(Directory, ExcludeDirMask, IncludeFileMask: string): TStrin
DebugLn(['Search ADD ',Filename]); DebugLn(['Search ADD ',Filename]);
GatherFiles.Add(Filename); GatherFiles.Add(Filename);
end else begin end else begin
DebugLn(['Search MISMATCH ',Filename]); //DebugLn(['Search MISMATCH ',Filename]);
end; end;
end; end;
until FindNextUTF8(FileInfo)<>0; until FindNextUTF8(FileInfo)<>0;

View File

@ -2101,7 +2101,7 @@ begin
DirEndMask:=FindDirectoryEnd(Mask,DirStartMask); DirEndMask:=FindDirectoryEnd(Mask,DirStartMask);
DirEndFile:=FindDirectoryEnd(Filename,DirStartFile); DirEndFile:=FindDirectoryEnd(Filename,DirStartFile);
//debugln(' Compare "',copy(Mask,DirStartMask,DirEndMask-DirStartMask),'"', //debugln(' Compare "',copy(Mask,DirStartMask,DirEndMask-DirStartMask),'"',
// ' "',copy(Filename,DirStartFile,DirEndFile-DirStartFile),'"'); // ' "',copy(Filename,DirStartFile,DirEndFile-DirStartFile),'"');
// compare directories // compare directories
BracketMaskPos:=0; BracketMaskPos:=0;
while (DirStartMask<DirEndMask) do begin while (DirStartMask<DirEndMask) do begin
@ -2123,16 +2123,16 @@ begin
Fits:=true; Fits:=true;
end else begin end else begin
StopChar:=DirStartMask; StopChar:=DirStartMask;
if (BracketMaskPos>0) then begin if (BracketMaskPos>0) and (Mask[StopChar] in [',','}']) then begin
while (StopChar<DirEndMask) and (Mask[StopChar]<>'}') do while (StopChar<DirEndMask) and (Mask[StopChar]<>'}') do
inc(StopChar); inc(StopChar);
inc(StopChar); inc(StopChar);
end; end;
if StopChar>=DirEndMask then if StopChar>=DirEndMask then
Fits:=false Fits:=true
else begin else begin
while (DirStartFile<DirEndFile) while (DirStartFile<DirEndFile)
and (not CharsEqual(Filename[DirStartFile],Mask[DirStartMask])) and (not CharsEqual(Filename[DirStartFile],Mask[StopChar]))
do do
inc(DirStartFile); inc(DirStartFile);
Fits:=DirStartFile<DirEndFile; Fits:=DirStartFile<DirEndFile;