IDE: compiler tests: added warnings when a search path does not exist

git-svn-id: trunk@13203 -
This commit is contained in:
mattias 2007-12-07 13:50:30 +00:00
parent 954c637752
commit 7cac0aa984
5 changed files with 55 additions and 17 deletions

View File

@ -194,7 +194,7 @@ type
function FindDeepestNodeAtPos(StartNode: TCodeTreeNode; P: integer;
ExceptionOnNotFound: boolean): TCodeTreeNode;
function CaretToCleanPos(Caret: TCodeXYPosition;
var CleanPos: integer): integer; // 0=valid CleanPos
out CleanPos: integer): integer; // 0=valid CleanPos
//-1=CursorPos was skipped, CleanPos between two links
// 1=CursorPos beyond scanned code
//-2=X,Y beyond source
@ -203,7 +203,7 @@ type
function CleanPosToCaret(CleanPos: integer;
out Caret:TCodeXYPosition): boolean; // true=ok, false=invalid CleanPos
function CleanPosToCaretAndTopLine(CleanPos: integer;
var Caret:TCodeXYPosition; var NewTopLine: integer): boolean; // true=ok, false=invalid CleanPos
out Caret:TCodeXYPosition; out NewTopLine: integer): boolean; // true=ok, false=invalid CleanPos
function CleanPosToStr(CleanPos: integer): string;
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
ResolveComments: boolean; var SameArea: TAtomPosition);
@ -2120,8 +2120,9 @@ begin
end;
function TCustomCodeTool.CaretToCleanPos(Caret: TCodeXYPosition;
var CleanPos: integer): integer;
out CleanPos: integer): integer;
begin
CleanPos:=0;
//DebugLn('TCustomCodeTool.CaretToCleanPos A ',Caret.Code.Filename,' ',Caret.Code.SourceLength);
Caret.Code.LineColToPosition(Caret.Y,Caret.X,CleanPos);
//DebugLn('TCustomCodeTool.CaretToCleanPos B ',CleanPos,',',Caret.Y,',',Caret.X);
@ -2156,9 +2157,11 @@ begin
end;
function TCustomCodeTool.CleanPosToCaretAndTopLine(CleanPos: integer;
var Caret:TCodeXYPosition; var NewTopLine: integer): boolean;
out Caret:TCodeXYPosition; out NewTopLine: integer): boolean;
// true=ok, false=invalid CleanPos
begin
Caret:=CleanCodeXYPosition;
NewTopLine:=0;
Result:=CleanPosToCaret(CleanPos,Caret);
if Result then begin
if JumpCentered then begin

View File

@ -1,6 +1,6 @@
<?xml version="1.0"?>
<CONFIG>
<Package Version="2">
<Package Version="3">
<Name Value="QuickFixExample"/>
<CompilerOptions>
<Version Value="5"/>
@ -24,14 +24,14 @@
<Type Value="RunAndDesignTime"/>
<RequiredPkgs Count="3">
<Item1>
<PackageName Value="IDEIntf"/>
<PackageName Value="CodeTools"/>
</Item1>
<Item2>
<PackageName Value="FCL"/>
<MinVersion Major="1" Valid="True"/>
</Item2>
<Item3>
<PackageName Value="CodeTools"/>
<PackageName Value="IDEIntf"/>
</Item3>
</RequiredPkgs>
<UsageOptions>

View File

@ -28,7 +28,7 @@ uses
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
Clipbrd, StdCtrls, Buttons, FileUtil, Process,
KeywordFuncLists, CodeToolManager,
IDEExternToolIntf,
MacroIntf, IDEExternToolIntf,
IDEProcs, EnvironmentOpts, LazarusIDEStrConsts,
CompilerOptions, ExtToolEditDlg, TransferMacros, LazConf, Menus, ExtCtrls;
@ -73,7 +73,8 @@ type
procedure SetMacroList(const AValue: TTransferMacroList);
procedure SetOptions(const AValue: TCompilerOptions);
procedure SetMsgDirectory(Index: integer; const CurDir: string);
function CheckSpecialCharsInPath(const Title, Path: string): TModalResult;
function CheckSpecialCharsInPath(const Title, ExpandedPath: string): TModalResult;
function CheckNonExistsingSearchPaths(const Title, ExpandedPath: string): TModalResult;
function CheckCompilerExecutable(const CompilerFilename: string): TModalResult;
function CheckAmbiguousFPCCfg(const CompilerFilename: string): TModalResult;
function CheckCompilerConfig(const CompilerFilename: string;
@ -194,7 +195,7 @@ begin
FDirectories[Index]:=CurDir;
end;
function TCheckCompilerOptsDlg.CheckSpecialCharsInPath(const Title, Path: string
function TCheckCompilerOptsDlg.CheckSpecialCharsInPath(const Title, ExpandedPath: string
): TModalResult;
procedure AddStr(var s: string; const Addition: string);
@ -211,7 +212,7 @@ var
ErrorMsg: String;
HasChars: TCCOSpecialChars;
begin
FindSpecialCharsInPath(Path,HasChars);
FindSpecialCharsInPath(ExpandedPath,HasChars);
Warning:=SpecialCharsToStr(HasChars*[ccoscSpaces,ccoscNonASCII,
ccoscWrongPathDelim,ccoscUnusualChars]);
ErrorMsg:=SpecialCharsToStr(HasChars*[ccoscSpecialChars,ccoscNewLine]);
@ -229,6 +230,25 @@ begin
end;
end;
function TCheckCompilerOptsDlg.CheckNonExistsingSearchPaths(const Title,
ExpandedPath: string): TModalResult;
var
p: Integer;
CurPath: String;
begin
Result:=mrOk;
p:=0;
repeat
CurPath:=GetNextDirectoryInSearchPath(ExpandedPath,p);
if (CurPath<>'') and (not IDEMacros.StrHasMacros(CurPath))
and (FilenameIsAbsolute(CurPath)) then begin
if not DirPathExistsCached(CurPath) then begin
AddWarning(Title+' does not exists: '+CurPath);
end;
end;
until p>length(ExpandedPath);
end;
function TCheckCompilerOptsDlg.CheckCompilerExecutable(
const CompilerFilename: string): TModalResult;
var
@ -815,8 +835,16 @@ begin
end;
// check for non existing paths
CheckNonExistsingSearchPaths('include search path',
Options.GetIncludePath(false));
CheckNonExistsingSearchPaths('library search path',
Options.GetLibraryPath(false));
CheckNonExistsingSearchPaths('unit search path',
Options.GetUnitPath(false));
CheckNonExistsingSearchPaths('source search path',
Options.GetSrcPath(false));
// fetch compiler filename
CompilerFilename:=Options.ParsedOpts.GetParsedValue(pcosCompilerPath);
// check compiler filename

View File

@ -341,6 +341,9 @@ type
function GetSrcPath(RelativeToBaseDir: boolean;
Parsed: TCompilerOptionsParseType = coptParsed;
WithProjDir: boolean = true): string;
function GetDebugPath(RelativeToBaseDir: boolean;
Parsed: TCompilerOptionsParseType = coptParsed;
WithProjDir: boolean = true): string;
function GetLibraryPath(RelativeToBaseDir: boolean;
Parsed: TCompilerOptionsParseType = coptParsed;
WithProjDir: boolean = true): string;
@ -1469,6 +1472,12 @@ begin
Result:=GetPath(pcosSrcPath,icoSrcPath,RelativeToBaseDir,Parsed,WithProjDir);
end;
function TBaseCompilerOptions.GetDebugPath(RelativeToBaseDir: boolean;
Parsed: TCompilerOptionsParseType; WithProjDir: boolean): string;
begin
Result:=GetPath(pcosDebugPath,icoNone,RelativeToBaseDir,Parsed,WithProjDir);
end;
function TBaseCompilerOptions.GetLibraryPath(RelativeToBaseDir: boolean;
Parsed: TCompilerOptionsParseType; WithProjDir: boolean): string;
begin

View File

@ -796,11 +796,9 @@ begin
if not CheckPutSearchPath('source search path',OldPath,Options.GetSrcPath(false)) then
exit(false);
Options.UnitOutputDirectory := edtUnitOutputDir.Text;
OldPath:=Options.GetParsedPath(pcosDebugPath,icoNone,false);
OldPath:=Options.GetDebugPath(false);
Options.DebugPath := edtDebugPath.Text;
if not CheckPutSearchPath('debugger search path',OldPath,
Options.GetParsedPath(pcosDebugPath,icoNone,false))
then
if not CheckPutSearchPath('debugger search path',OldPath,Options.GetDebugPath(false)) then
exit(false);
i:=LCLWidgetTypeComboBox.Itemindex;