FIX: Error in search text in files

This commit is contained in:
Alexander Koblov 2007-12-23 20:30:04 +00:00
commit e69d74e713
5 changed files with 31 additions and 20 deletions

View file

@ -67,8 +67,8 @@ const
begin
{$IFDEF MSWINDOWS}
AssignFile(output, GetHomeDir + 'doublecmd.log');
Rewrite(output);
//AssignFile(output, GetHomeDir + 'doublecmd.log');
//Rewrite(output);
{$ENDIF}
Application.Title:='Double Commander';

View file

@ -60,7 +60,7 @@ const
'Radek Cervinka (radek.cervinka@centrum.cz) - author of Seksi Commander'+#13+
'Contributors:'+#13+
'Tolstov Igor (attid@yandex.ru)'+#13+
'Zolotov Alex'+#13+
'Zolotov Alex (zolotov-alex@shamangrad.net)'+#13+
'Peter Cernoch (pcernoch@volny.cz) - author PFM'+#13+
'Pavel Letko (letcuv@centrum.cz) - multirename, split, linker'+#13+
'Jiri Karasek (jkarasek@centrum.cz)'+#13+

View file

@ -368,25 +368,28 @@ end;
procedure TfrmFindDlg.btnWorkWithFoundClick(Sender: TObject);
var
I, Count : Integer;
fr:TFileRecItem;
pfri:PFileRecItem;
sr : TSearchRec;
begin
Count := lsFoundedFiles.Items.Count - 1;
frmMain.ActiveFrame.pnlFile.FileList.Clear;
New(pfri);
with pfri^ do
for I := 0 to Count do
begin
fr.sNameNoExt := lsFoundedFiles.Items[I];
fr.sName := fr.sNameNoExt;
FindFirstEx(fr.sNameNoExt, faAnyFile, sr);
fr.sExt := ExtractFileExt(fr.sNameNoExt);
fr.iSize := sr.Size;
fr.sTime := DateTimeToStr(Trunc(FileDateToDateTime(sr.Time)));
fr.iMode := sr.Attr;
fr.sModeStr := AttrToStr(sr.Attr);
fr.bLinkIsDir:=False;
fr.bSelected:=False;
frmMain.ActiveFrame.pnlFile.FileList.AddItem(@fr);
sNameNoExt := lsFoundedFiles.Items[I];
sName := sNameNoExt;
FindFirstEx(sNameNoExt, faAnyFile, sr);
sExt := ExtractFileExt(sNameNoExt);
iSize := sr.Size;
sTime := DateTimeToStr(Trunc(FileDateToDateTime(sr.Time)));
iMode := sr.Attr;
sModeStr := AttrToStr(sr.Attr);
bLinkIsDir:=False;
bSelected:=False;
frmMain.ActiveFrame.pnlFile.FileList.AddItem(pfri);
end;
Dispose(pfri);
frmMain.ActiveFrame.pnlFile.FileList.UpdateFileInformation(pmDirectory);
frmMain.ActiveFrame.pnlFile.Sort;
frmMain.ActiveFrame.pnlFile.ActiveDir := '';

View file

@ -51,7 +51,7 @@ function msgYesNoCancel(const sMsg:String):TMyMsgResult;
procedure msgOK(const sMsg:String);
function msgWarning(const sMsg:String):Boolean;
procedure msgError(const sMsg:String);
procedure msgError(const sMsg:String; Thread : TThread = nil);
function MsgBox(const sMsg:String; const Buttons: array of TMyMsgButton; ButDefault, ButEscape:TMyMsgButton):TMyMsgResult;
function MsgBoxForThread(Thread : TThread;const sMsg:String; const Buttons: array of TMyMsgButton; ButDefault, ButEscape:TMyMsgButton):TMyMsgResult;
@ -233,9 +233,12 @@ begin
MsgBox(sMsg,[msmbOK],msmbOK, msmbOK);
end;
procedure msgError(const sMsg:String);
procedure msgError(const sMsg:String; Thread : TThread = nil);
begin
MsgBox(sMsg,[msmbOK],msmbOK, msmbOK);
if Assigned(Thread) then
MsgBoxForThread(Thread, sMsg,[msmbOK],msmbOK, msmbOK)
else
MsgBox(sMsg,[msmbOK],msmbOK, msmbOK);
end;
function msgWarning(const sMsg:String):Boolean;

View file

@ -117,7 +117,7 @@ TFindThread = class(TThread)
implementation
uses
LCLProc, Dialogs, Masks, uLng, uFindMmap, uFindEx, uGlobs;
LCLProc, Dialogs, Masks, uLng, uFindMmap, uFindEx, uGlobs, uShowMsg, uOSUtils;
{ TFindThread }
@ -165,7 +165,7 @@ begin
except
on E:Exception do
ShowMessage(E.Message);
msgError(E.Message, Self);
end;
end;
@ -326,6 +326,11 @@ if not MatchesMaskList(sr.Name, FFileMask) then
if (FFindInFiles and Result) then
begin
if FPS_ISDIR(sr.Attr) then
begin
Result := False;
Exit;
end;
Result := FindInFile(Folder + PathDelim + sr.Name, FFindData, FCaseSens);
if (FReplaceInFiles and Result) then