diff --git a/ide/cleandirdlg.lfm b/ide/cleandirdlg.lfm index af02f4991a..9340a387e7 100644 --- a/ide/cleandirdlg.lfm +++ b/ide/cleandirdlg.lfm @@ -155,12 +155,9 @@ object CleanDirectoryDialog: TCleanDirectoryDialog OKButton.Name = 'OKButton' OKButton.Caption = '&ОК' HelpButton.Name = 'HelpButton' - HelpButton.Caption = '&Справка' CloseButton.Name = 'CloseButton' - CloseButton.Caption = '&Закрыть' CloseButton.Enabled = False CancelButton.Name = 'CancelButton' - CancelButton.Caption = 'Отмена' TabOrder = 3 ShowButtons = [pbOK, pbCancel, pbHelp] ShowBevel = False diff --git a/ide/cleandirdlg.pas b/ide/cleandirdlg.pas index fd030cd322..209d66f752 100644 --- a/ide/cleandirdlg.pas +++ b/ide/cleandirdlg.pas @@ -100,6 +100,7 @@ procedure TCleanDirectoryDialog.OkButtonClick(Sender: TObject); var List: TStrings; begin + ModalResult:=mrNone; SaveSettings; if not SearchFilesToDelete(List) then exit; try @@ -325,6 +326,7 @@ var const FilterAsText: string): boolean; var Expr: String; + s: String; begin Result:=false; if FilterAsText='' then begin @@ -339,12 +341,16 @@ var Expr:=FilterAsText; try Filter.Expression:=Expr; + // do a simple test + Filter.Exec('test.file'); Result:=true; except on E: Exception do begin - MessageDlg('Invalid Mask', - 'The mask "'+FilterAsText+'" is not a valid expression.', - mtError,[mbCancel],0); + if SimpleSyntax then + s:=Format(lisTheFileMaskIsInvalid, [FilterAsText]) + else + s:=Format(lisTheFileMaskIsNotAValidRegularExpression, [FilterAsText]); + MessageDlg(lisInvalidMask, s, mtError, [mbCancel], 0); end; end; end; @@ -364,10 +370,10 @@ begin Directory:=AppendPathDelim(Directory); // setup filters - SetupFilter(RemoveFilterRegExpr,SimpleSyntaxRemoveCheckbox.Checked, - RemoveCombobox.Text); - SetupFilter(KeepFilterRegExpr,SimpleSyntaxKeepCheckbox.Checked, - KeepCombobox.Text); + if not SetupFilter(RemoveFilterRegExpr,SimpleSyntaxRemoveCheckbox.Checked, + RemoveCombobox.Text) then exit; + if not SetupFilter(KeepFilterRegExpr,SimpleSyntaxKeepCheckbox.Checked, + KeepCombobox.Text) then exit; // search files List:=TStringList.Create; diff --git a/ide/ideprocs.pp b/ide/ideprocs.pp index a6001d67c9..63da17d82e 100644 --- a/ide/ideprocs.pp +++ b/ide/ideprocs.pp @@ -2515,12 +2515,12 @@ end; {------------------------------------------------------------------------------ function SimpleSyntaxToRegExpr(const Src: string): string; - . -> \. * -> .* ? -> . , -> | ; -> | - + Backslash characters .+ + Finally enclose by ^( )$ ------------------------------------------------------------------------------} function SimpleSyntaxToRegExpr(const Src: string): string; @@ -2538,7 +2538,7 @@ begin c:=Src[SrcPos]; case c of '\': inc(SrcPos); - '*','.': + '*','.','+': inc(DestLen); end; inc(SrcPos); @@ -2559,11 +2559,11 @@ begin Result[DestPos]:=Src[SrcPos]; inc(DestPos); end; - '.': + '.','+': begin Result[DestPos]:='\'; inc(DestPos); - Result[DestPos]:='.'; + Result[DestPos]:=c; inc(DestPos); end; '*': diff --git a/ide/lazarusidestrconsts.pas b/ide/lazarusidestrconsts.pas index ad69b72219..ce62c8ed19 100644 --- a/ide/lazarusidestrconsts.pas +++ b/ide/lazarusidestrconsts.pas @@ -3316,6 +3316,10 @@ resourcestring lisUnableToReadFile = 'Unable to read file'; lisUnableToReadFilename = 'Unable to read file %s%s%s.'; lisErrorDeletingFile = 'Error deleting file'; + lisInvalidMask = 'Invalid Mask'; + lisTheFileMaskIsNotAValidRegularExpression = 'The file mask "%s" is not a ' + +'valid regular expression.'; + lisTheFileMaskIsInvalid = 'The file mask "%s" is invalid.'; lisUnableToDeleteAmbiguousFile = 'Unable to delete ambiguous file %s%s%s'; lisErrorRenamingFile = 'Error renaming file'; lisUnableToRenameAmbiguousFileTo = 'Unable to rename ambiguous file %s%s%s%'