From 1e6a416750541dc62e9619a7238eb286fd164bbf Mon Sep 17 00:00:00 2001 From: mattias Date: Sun, 22 Feb 2004 18:33:03 +0000 Subject: [PATCH] added write check git-svn-id: trunk@5223 - --- components/codetools/definetemplates.pas | 3 ++- ide/dialogprocs.pas | 15 ++++++++++++++- ide/main.pp | 5 +++++ 3 files changed, 21 insertions(+), 2 deletions(-) diff --git a/components/codetools/definetemplates.pas b/components/codetools/definetemplates.pas index 3f1743ed20..80917dca45 100644 --- a/components/codetools/definetemplates.pas +++ b/components/codetools/definetemplates.pas @@ -3206,7 +3206,8 @@ begin +';'+Dir+'rtl'+DS+'objpas'+DS +';'+Dir+'rtl'+DS+'objpas'+DS+'sysutils' +';'+Dir+'rtl'+DS+'objpas'+DS+'classes' - +';'+Dir+'rtl'+DS+'inc'+DS; + +';'+Dir+'rtl'+DS+'inc'+DS + +';'+Dir+'rtl'+DS+'inc'+DS+'graph'+DS; if (TargetOS<>'') and (TargetOS<>SrcOS) then s:=s+';'+Dir+'rtl'+DS+TargetOS+DS; s:=s+ diff --git a/ide/dialogprocs.pas b/ide/dialogprocs.pas index 88210228ae..adafa7c139 100644 --- a/ide/dialogprocs.pas +++ b/ide/dialogprocs.pas @@ -58,7 +58,8 @@ function LoadCodeBuffer(var ACodeBuffer: TCodeBuffer; const AFilename: string; Flags: TLoadBufferFlags): TModalResult; function CreateEmptyFile(const Filename: string; ErrorButtons: TMsgDlgButtons): TModalResult; - +function CheckFileIsWritable(const Filename: string; + ErrorButtons: TMsgDlgButtons): TModalResult; implementation @@ -158,5 +159,17 @@ begin Result:=mrOk; end; +function CheckFileIsWritable(const Filename: string; + ErrorButtons: TMsgDlgButtons): TModalResult; +begin + Result:=mrOk; + while not FileIsWritable(Filename) do begin + Result:=MessageDlg('File is not writable', + 'Unable to write to file "'+Filename+'"', + mtError,ErrorButtons+[mbCancel],0); + if Result<>mrRetry then exit; + end; +end; + end. diff --git a/ide/main.pp b/ide/main.pp index fadefdaef3..c0444ac32b 100644 --- a/ide/main.pp +++ b/ide/main.pp @@ -6519,6 +6519,8 @@ begin writeln('TMainIDE.DoConvertDelphiUnit A ',DelphiFilename); Result:=CheckDelphiFileExt(DelphiFilename); if Result<>mrOk then exit; + Result:=CheckFileIsWritable(DelphiFilename,[mbAbort]); + if Result<>mrOk then exit; Result:=CheckFilenameForLCLPaths(DelphiFilename); if Result<>mrOk then exit; // close Delphi files in editor @@ -10335,6 +10337,9 @@ end. { ============================================================================= $Log$ + Revision 1.713 2004/02/22 18:33:03 mattias + added write check + Revision 1.712 2004/02/21 15:37:32 mattias moved compiler options to project menu, added -CX for smartlinking