ADD: "Follow symlinks" option to find files dialog

This commit is contained in:
Alexander Koblov 2010-04-24 20:09:38 +00:00
commit 4793cf5f0e
6 changed files with 28 additions and 6 deletions

View file

@ -36,7 +36,7 @@ object frmFindDlg: TfrmFindDlg
Width = 667
ActivePage = tsStandard
Anchors = [akTop, akLeft, akRight, akBottom]
TabIndex = 1
TabIndex = 0
TabOrder = 0
object tsStandard: TTabSheet
Caption = 'Standard'
@ -320,6 +320,20 @@ object frmFindDlg: TfrmFindDlg
Shape = bsTopLine
Style = bsRaised
end
object cmbFollowSymLinks: TCheckBox
AnchorSideTop.Control = cmbFindFileMask
AnchorSideTop.Side = asrBottom
AnchorSideRight.Control = cmbFindFileMask
AnchorSideRight.Side = asrBottom
Left = 563
Height = 17
Top = 47
Width = 90
Anchors = [akTop, akRight]
BorderSpacing.Top = 4
Caption = 'Follow symlinks'
TabOrder = 8
end
end
object tsAdvanced: TTabSheet
Caption = 'Advanced'

View file

@ -12,6 +12,7 @@ TFRMFINDDLG.CBREPLACETEXT.CAPTION=Re&place text
TFRMFINDDLG.CBFINDTEXT.CAPTION=Find &text in file
TFRMFINDDLG.CBUSEPLUGIN.CAPTION=&Use search plugin:
TFRMFINDDLG.CBREGEXP.CAPTION=&Regular expressions
TFRMFINDDLG.CMBFOLLOWSYMLINKS.CAPTION=Follow symlinks
TFRMFINDDLG.TSADVANCED.CAPTION=Advanced
TFRMFINDDLG.CBDATEFROM.CAPTION=Date From:
TFRMFINDDLG.CBNOTOLDERTHAN.CAPTION=Not older than:

View file

@ -59,6 +59,7 @@ type
cbReplaceText: TCheckBox;
cbTimeFrom: TCheckBox;
cbTimeTo: TCheckBox;
cmbFollowSymLinks: TCheckBox;
cmbNotOlderThanUnit: TComboBox;
cmbFileSizeUnit: TComboBox;
cbUsePlugin: TCheckBox;
@ -455,10 +456,11 @@ var
begin
with FindOptions do
begin
StartPath := edtFindPathStart.Text;
FilesMasks := cmbFindFileMask.Text;
SearchDepth := cbSearchDepth.ItemIndex - 1;
RegExp := cbRegExp.Checked;
StartPath := edtFindPathStart.Text;
FilesMasks := cmbFindFileMask.Text;
SearchDepth := cbSearchDepth.ItemIndex - 1;
RegExp := cbRegExp.Checked;
FollowSymLinks := cmbFollowSymLinks.Checked;
{ File attributes }
AttributesPattern := edtAttrib.Text;

View file

@ -40,6 +40,7 @@ type
FilesMasks: String;
SearchDepth: Integer; // -1 = unlimited
RegExp: Boolean;
FollowSymLinks: Boolean;
AttributesPattern: String;
{ Date/time }
IsDateFrom,
@ -305,4 +306,4 @@ begin
end;
end;
end.
end.

View file

@ -366,6 +366,8 @@ begin
DebugLn('Search in sub folders = ', Path);
if not Terminated and (FindFirstEx(Path, faDirectory, sr) = 0) then
repeat
if (FSearchTemplate.FollowSymLinks = False) and FPS_ISLNK(sr.Attr) then
Continue;
if ((sr.Name <> '.') and (sr.Name <> '..')) then
WalkAdr(sNewDir + PathDelim + sr.Name);
until Terminated or (FindNextEx(sr) <> 0);

View file

@ -258,6 +258,7 @@ begin
FilesMasks:= AConfig.GetValue(ANode, 'FilesMasks', '*');
SearchDepth:= AConfig.GetValue(ANode, 'SearchDepth', -1);
RegExp:= AConfig.GetValue(ANode, 'RegExp', False);
FollowSymLinks:= AConfig.GetValue(ANode, 'FollowSymLinks', False);
AttributesPattern:= AConfig.GetValue(ANode, 'AttributesPattern', '');
// date/time
IsDateFrom:= AConfig.GetValue(ANode, 'IsDateFrom', False);
@ -374,6 +375,7 @@ begin
AConfig.AddValue(SubNode, 'FilesMasks', FilesMasks);
AConfig.AddValue(SubNode, 'SearchDepth', SearchDepth);
AConfig.AddValue(SubNode, 'RegExp', RegExp);
AConfig.AddValue(SubNode, 'FollowSymLinks', FollowSymLinks);
AConfig.AddValue(SubNode, 'AttributesPattern', AttributesPattern);
// date/time
AConfig.AddValue(SubNode, 'IsDateFrom', IsDateFrom);