mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-04-08 11:58:12 +02:00
LazUtils: Replace TMask with a faster and better version from José Mejuto.
git-svn-id: trunk@64667 -
This commit is contained in:
parent
b8a5b2df73
commit
d82f15fb2b
@ -795,12 +795,8 @@ var
|
||||
// Deal with both files and directories
|
||||
if (PathInfo.Attr and faDirectory) = 0 then
|
||||
begin // File
|
||||
{$IFDEF Windows}
|
||||
if (MaskList = nil) or MaskList.MatchesWindowsMask(PathInfo.Name)
|
||||
{$ELSE}
|
||||
if (MaskList = nil) or MaskList.Matches(PathInfo.Name)
|
||||
{$ENDIF}
|
||||
then begin
|
||||
if (MaskList = nil) or MaskList.Matches(PathInfo.Name) then
|
||||
begin
|
||||
FPath := APath;
|
||||
FLevel := ALevel;
|
||||
FFileInfo := PathInfo;
|
||||
@ -848,14 +844,9 @@ var
|
||||
i: Integer;
|
||||
Dir: String;
|
||||
OtherDir: String;
|
||||
MaskOptions: TMaskOptions;
|
||||
begin
|
||||
if FSearching then RaiseSearchingError;
|
||||
if CaseSensitive then
|
||||
MaskOptions := [moCaseSensitive]
|
||||
else
|
||||
MaskOptions := [];
|
||||
MaskList := TMaskList.Create(ASearchMask, FMaskSeparator, MaskOptions);
|
||||
MaskList := TMaskList.CreateSysNative(ASearchMask, FMaskSeparator, CaseSensitive);
|
||||
// empty mask = all files mask
|
||||
if MaskList.Count = 0 then
|
||||
FreeAndNil(MaskList);
|
||||
@ -901,7 +892,7 @@ begin
|
||||
finally
|
||||
SearchDirectories.Free;
|
||||
FSearching := False;
|
||||
if MaskList <> nil then MaskList.Free;
|
||||
MaskList.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
|
@ -16,7 +16,6 @@ interface
|
||||
|
||||
resourceString
|
||||
lrsModified = ' modified ';
|
||||
lrsInvalidCharSet = 'The char set in mask "%s" is not valid!';
|
||||
lrsSize = ' size ';
|
||||
lrsFileDoesNotExist = 'file "%s" does not exist';
|
||||
lrsFileIsADirectoryAndNotAnExecutable = 'file "%s" is a directory and not an'
|
||||
@ -42,6 +41,15 @@ resourceString
|
||||
lrsERRORInCode = 'ERROR in code: ';
|
||||
lrsCreatingGdbCatchableError = 'Creating gdb catchable error:';
|
||||
|
||||
// Masks
|
||||
rsInvalidCharMaskAt = 'Invalid char mask "%s" at %d';
|
||||
rsInvalidCharMask = 'Invalid char mask "%s"';
|
||||
rsMissingCloseCharMaskAt = 'Missing close char mask "%s" at %d';
|
||||
rsMissingCloseCharMask = 'Missing close char mask "%s"';
|
||||
rsIncompleteMask = 'Reached end of mask, but missing close/escape sequence.';
|
||||
rsInvalidEscapeChar = 'Escape character must be ASCII <= 127';
|
||||
rsInternalError = 'Internal %s error.';
|
||||
|
||||
// XPath
|
||||
lrsNodeSet = 'node set';
|
||||
lrsBoolean = 'boolean';
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -215,7 +215,7 @@ resourceString
|
||||
|
||||
// LResource, Menus, ExtCtrls, ImgList, Spin
|
||||
// StdCtrls, Calendar, CustomTimer, Forms, Grids, LCLProc, Controls, ComCtrls,
|
||||
// ExtDlgs, EditBtn, Masks, MaskEdit
|
||||
// ExtDlgs, EditBtn, MaskEdit
|
||||
sInvalidActionRegistration = 'Invalid action registration';
|
||||
sInvalidActionUnregistration = 'Invalid action unregistration';
|
||||
sInvalidActionEnumeration = 'Invalid action enumeration';
|
||||
@ -229,7 +229,6 @@ resourceString
|
||||
sDuplicateMenus = 'Duplicate menus';
|
||||
sCannotFocus = 'Cannot focus a disabled or invisible window';
|
||||
sParentRequired = 'Control "%s" has no parent window.';
|
||||
sInvalidCharSet = 'The char set in mask "%s" is not valid!';
|
||||
SMaskEditNoMatch = 'The current text does not match the specified mask.';
|
||||
|
||||
rsInvalidPropertyValue = 'Invalid property value';
|
||||
|
@ -680,7 +680,7 @@ var
|
||||
MaskList: TMaskList;
|
||||
Files: TList;
|
||||
FileItem: TFileItem;
|
||||
MaskOptions: TMaskOptions;
|
||||
CaseSens: Boolean;
|
||||
{$if defined(windows) and not defined(wince)}
|
||||
ErrMode : LongWord;
|
||||
{$endif}
|
||||
@ -696,14 +696,12 @@ begin
|
||||
Delete(AMask, Length(AMask), 1);
|
||||
if Trim(AMask) = '' then
|
||||
AMask := AllFilesMask;
|
||||
MaskOptions := []; // was moDisableSets
|
||||
{$ifdef NotLiteralFilenames}
|
||||
if (ACaseSensitivity = mcsCaseSensitive) then
|
||||
CaseSens := ACaseSensitivity = mcsCaseSensitive;
|
||||
{$else}
|
||||
if (ACaseSensitivity <> mcsCaseInsensitive) then
|
||||
CaseSens := ACaseSensitivity <> mcsCaseInsensitive;
|
||||
{$endif}
|
||||
Include(MaskOptions, moCaseSensitive);
|
||||
MaskList := TMaskList.Create(AMask, ';', MaskOptions);
|
||||
MaskList := TMaskList.Create(AMask, ';', CaseSens);
|
||||
try
|
||||
if AFileSortType = fstNone then
|
||||
Files:=nil
|
||||
|
Loading…
Reference in New Issue
Block a user