FIX: Case insensitive file search for non ACSII file names

This commit is contained in:
Alexander Koblov 2010-01-23 19:13:37 +00:00
commit 1c2c6178d5
2 changed files with 12 additions and 3 deletions

View file

@ -4,7 +4,7 @@
Find dialog, with searching in thread
Copyright (C) 2003-2004 Radek Cervinka (radek.cervinka@centrum.cz)
Copyright (C) 2006-2009 Koblov Alexander (Alexx2000@mail.ru)
Copyright (C) 2006-2010 Koblov Alexander (Alexx2000@mail.ru)
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by

View file

@ -74,6 +74,7 @@ TFindThread = class(TThread)
FReplaceInFiles : Boolean;
FReplaceData : String;
procedure SetFileMask(const AValue: String);
procedure SetSearchDepth(const AValue: Integer);
function CheckFileDate(DT : TFileTime) : Boolean;
function CheckFileSize(FileSize : Int64) : Boolean;
@ -91,7 +92,7 @@ TFindThread = class(TThread)
procedure FillSearchRecord(var Srec:TSearchAttrRecord);
function IsAborting: Boolean;
property FilterMask:String read FFileMask write FFileMask;
property FilterMask:String read FFileMask write SetFileMask;
property PathStart:String read FPathStart write FPathStart;
property Items:TStrings write FItems;
property RegularExpressions: Boolean read FRegExp write FRegExp;
@ -192,6 +193,14 @@ begin
FSearchDepth:= AValue;
end;
procedure TFindThread.SetFileMask(const AValue: String);
begin
// use case insensitive mask because
// MatchesMaskList work incorrect with non ACSII characters
// since it use UpCase function
FFileMask:= UTF8UpperCase(AValue);
end;
procedure TFindThread.AddFile;
begin
FItems.Add(FFoundFile);
@ -376,7 +385,7 @@ begin
Exit(False);
//DebugLn('File = ', sr.Name);
if (not FRegExp) and (not MatchesMaskList(sr.Name, FFileMask)) then
if (not FRegExp) and (not MatchesMaskList(UTF8UpperCase(sr.Name), FFileMask)) then
Exit(False);
if (FIsDateFrom or FIsDateTo or FIsTimeFrom or FIsTimeTo) then