mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-08-17 20:59:12 +02:00
IDE: compiler tests: added warnings when a search path does not exist
git-svn-id: trunk@13203 -
This commit is contained in:
parent
954c637752
commit
7cac0aa984
@ -194,7 +194,7 @@ type
|
|||||||
function FindDeepestNodeAtPos(StartNode: TCodeTreeNode; P: integer;
|
function FindDeepestNodeAtPos(StartNode: TCodeTreeNode; P: integer;
|
||||||
ExceptionOnNotFound: boolean): TCodeTreeNode;
|
ExceptionOnNotFound: boolean): TCodeTreeNode;
|
||||||
function CaretToCleanPos(Caret: TCodeXYPosition;
|
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 was skipped, CleanPos between two links
|
||||||
// 1=CursorPos beyond scanned code
|
// 1=CursorPos beyond scanned code
|
||||||
//-2=X,Y beyond source
|
//-2=X,Y beyond source
|
||||||
@ -203,7 +203,7 @@ type
|
|||||||
function CleanPosToCaret(CleanPos: integer;
|
function CleanPosToCaret(CleanPos: integer;
|
||||||
out Caret:TCodeXYPosition): boolean; // true=ok, false=invalid CleanPos
|
out Caret:TCodeXYPosition): boolean; // true=ok, false=invalid CleanPos
|
||||||
function CleanPosToCaretAndTopLine(CleanPos: integer;
|
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;
|
function CleanPosToStr(CleanPos: integer): string;
|
||||||
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
procedure GetCleanPosInfo(CodePosInFront, CleanPos: integer;
|
||||||
ResolveComments: boolean; var SameArea: TAtomPosition);
|
ResolveComments: boolean; var SameArea: TAtomPosition);
|
||||||
@ -2120,8 +2120,9 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomCodeTool.CaretToCleanPos(Caret: TCodeXYPosition;
|
function TCustomCodeTool.CaretToCleanPos(Caret: TCodeXYPosition;
|
||||||
var CleanPos: integer): integer;
|
out CleanPos: integer): integer;
|
||||||
begin
|
begin
|
||||||
|
CleanPos:=0;
|
||||||
//DebugLn('TCustomCodeTool.CaretToCleanPos A ',Caret.Code.Filename,' ',Caret.Code.SourceLength);
|
//DebugLn('TCustomCodeTool.CaretToCleanPos A ',Caret.Code.Filename,' ',Caret.Code.SourceLength);
|
||||||
Caret.Code.LineColToPosition(Caret.Y,Caret.X,CleanPos);
|
Caret.Code.LineColToPosition(Caret.Y,Caret.X,CleanPos);
|
||||||
//DebugLn('TCustomCodeTool.CaretToCleanPos B ',CleanPos,',',Caret.Y,',',Caret.X);
|
//DebugLn('TCustomCodeTool.CaretToCleanPos B ',CleanPos,',',Caret.Y,',',Caret.X);
|
||||||
@ -2156,9 +2157,11 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
function TCustomCodeTool.CleanPosToCaretAndTopLine(CleanPos: integer;
|
function TCustomCodeTool.CleanPosToCaretAndTopLine(CleanPos: integer;
|
||||||
var Caret:TCodeXYPosition; var NewTopLine: integer): boolean;
|
out Caret:TCodeXYPosition; out NewTopLine: integer): boolean;
|
||||||
// true=ok, false=invalid CleanPos
|
// true=ok, false=invalid CleanPos
|
||||||
begin
|
begin
|
||||||
|
Caret:=CleanCodeXYPosition;
|
||||||
|
NewTopLine:=0;
|
||||||
Result:=CleanPosToCaret(CleanPos,Caret);
|
Result:=CleanPosToCaret(CleanPos,Caret);
|
||||||
if Result then begin
|
if Result then begin
|
||||||
if JumpCentered then begin
|
if JumpCentered then begin
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0"?>
|
<?xml version="1.0"?>
|
||||||
<CONFIG>
|
<CONFIG>
|
||||||
<Package Version="2">
|
<Package Version="3">
|
||||||
<Name Value="QuickFixExample"/>
|
<Name Value="QuickFixExample"/>
|
||||||
<CompilerOptions>
|
<CompilerOptions>
|
||||||
<Version Value="5"/>
|
<Version Value="5"/>
|
||||||
@ -24,14 +24,14 @@
|
|||||||
<Type Value="RunAndDesignTime"/>
|
<Type Value="RunAndDesignTime"/>
|
||||||
<RequiredPkgs Count="3">
|
<RequiredPkgs Count="3">
|
||||||
<Item1>
|
<Item1>
|
||||||
<PackageName Value="IDEIntf"/>
|
<PackageName Value="CodeTools"/>
|
||||||
</Item1>
|
</Item1>
|
||||||
<Item2>
|
<Item2>
|
||||||
<PackageName Value="FCL"/>
|
<PackageName Value="FCL"/>
|
||||||
<MinVersion Major="1" Valid="True"/>
|
<MinVersion Major="1" Valid="True"/>
|
||||||
</Item2>
|
</Item2>
|
||||||
<Item3>
|
<Item3>
|
||||||
<PackageName Value="CodeTools"/>
|
<PackageName Value="IDEIntf"/>
|
||||||
</Item3>
|
</Item3>
|
||||||
</RequiredPkgs>
|
</RequiredPkgs>
|
||||||
<UsageOptions>
|
<UsageOptions>
|
||||||
|
@ -28,7 +28,7 @@ uses
|
|||||||
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
Classes, SysUtils, LCLProc, LResources, Forms, Controls, Graphics, Dialogs,
|
||||||
Clipbrd, StdCtrls, Buttons, FileUtil, Process,
|
Clipbrd, StdCtrls, Buttons, FileUtil, Process,
|
||||||
KeywordFuncLists, CodeToolManager,
|
KeywordFuncLists, CodeToolManager,
|
||||||
IDEExternToolIntf,
|
MacroIntf, IDEExternToolIntf,
|
||||||
IDEProcs, EnvironmentOpts, LazarusIDEStrConsts,
|
IDEProcs, EnvironmentOpts, LazarusIDEStrConsts,
|
||||||
CompilerOptions, ExtToolEditDlg, TransferMacros, LazConf, Menus, ExtCtrls;
|
CompilerOptions, ExtToolEditDlg, TransferMacros, LazConf, Menus, ExtCtrls;
|
||||||
|
|
||||||
@ -73,7 +73,8 @@ type
|
|||||||
procedure SetMacroList(const AValue: TTransferMacroList);
|
procedure SetMacroList(const AValue: TTransferMacroList);
|
||||||
procedure SetOptions(const AValue: TCompilerOptions);
|
procedure SetOptions(const AValue: TCompilerOptions);
|
||||||
procedure SetMsgDirectory(Index: integer; const CurDir: string);
|
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 CheckCompilerExecutable(const CompilerFilename: string): TModalResult;
|
||||||
function CheckAmbiguousFPCCfg(const CompilerFilename: string): TModalResult;
|
function CheckAmbiguousFPCCfg(const CompilerFilename: string): TModalResult;
|
||||||
function CheckCompilerConfig(const CompilerFilename: string;
|
function CheckCompilerConfig(const CompilerFilename: string;
|
||||||
@ -194,7 +195,7 @@ begin
|
|||||||
FDirectories[Index]:=CurDir;
|
FDirectories[Index]:=CurDir;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TCheckCompilerOptsDlg.CheckSpecialCharsInPath(const Title, Path: string
|
function TCheckCompilerOptsDlg.CheckSpecialCharsInPath(const Title, ExpandedPath: string
|
||||||
): TModalResult;
|
): TModalResult;
|
||||||
|
|
||||||
procedure AddStr(var s: string; const Addition: string);
|
procedure AddStr(var s: string; const Addition: string);
|
||||||
@ -211,7 +212,7 @@ var
|
|||||||
ErrorMsg: String;
|
ErrorMsg: String;
|
||||||
HasChars: TCCOSpecialChars;
|
HasChars: TCCOSpecialChars;
|
||||||
begin
|
begin
|
||||||
FindSpecialCharsInPath(Path,HasChars);
|
FindSpecialCharsInPath(ExpandedPath,HasChars);
|
||||||
Warning:=SpecialCharsToStr(HasChars*[ccoscSpaces,ccoscNonASCII,
|
Warning:=SpecialCharsToStr(HasChars*[ccoscSpaces,ccoscNonASCII,
|
||||||
ccoscWrongPathDelim,ccoscUnusualChars]);
|
ccoscWrongPathDelim,ccoscUnusualChars]);
|
||||||
ErrorMsg:=SpecialCharsToStr(HasChars*[ccoscSpecialChars,ccoscNewLine]);
|
ErrorMsg:=SpecialCharsToStr(HasChars*[ccoscSpecialChars,ccoscNewLine]);
|
||||||
@ -229,6 +230,25 @@ begin
|
|||||||
end;
|
end;
|
||||||
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(
|
function TCheckCompilerOptsDlg.CheckCompilerExecutable(
|
||||||
const CompilerFilename: string): TModalResult;
|
const CompilerFilename: string): TModalResult;
|
||||||
var
|
var
|
||||||
@ -815,8 +835,16 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
// check for non existing paths
|
// 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);
|
CompilerFilename:=Options.ParsedOpts.GetParsedValue(pcosCompilerPath);
|
||||||
|
|
||||||
// check compiler filename
|
// check compiler filename
|
||||||
|
@ -341,6 +341,9 @@ type
|
|||||||
function GetSrcPath(RelativeToBaseDir: boolean;
|
function GetSrcPath(RelativeToBaseDir: boolean;
|
||||||
Parsed: TCompilerOptionsParseType = coptParsed;
|
Parsed: TCompilerOptionsParseType = coptParsed;
|
||||||
WithProjDir: boolean = true): string;
|
WithProjDir: boolean = true): string;
|
||||||
|
function GetDebugPath(RelativeToBaseDir: boolean;
|
||||||
|
Parsed: TCompilerOptionsParseType = coptParsed;
|
||||||
|
WithProjDir: boolean = true): string;
|
||||||
function GetLibraryPath(RelativeToBaseDir: boolean;
|
function GetLibraryPath(RelativeToBaseDir: boolean;
|
||||||
Parsed: TCompilerOptionsParseType = coptParsed;
|
Parsed: TCompilerOptionsParseType = coptParsed;
|
||||||
WithProjDir: boolean = true): string;
|
WithProjDir: boolean = true): string;
|
||||||
@ -1469,6 +1472,12 @@ begin
|
|||||||
Result:=GetPath(pcosSrcPath,icoSrcPath,RelativeToBaseDir,Parsed,WithProjDir);
|
Result:=GetPath(pcosSrcPath,icoSrcPath,RelativeToBaseDir,Parsed,WithProjDir);
|
||||||
end;
|
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;
|
function TBaseCompilerOptions.GetLibraryPath(RelativeToBaseDir: boolean;
|
||||||
Parsed: TCompilerOptionsParseType; WithProjDir: boolean): string;
|
Parsed: TCompilerOptionsParseType; WithProjDir: boolean): string;
|
||||||
begin
|
begin
|
||||||
|
@ -796,11 +796,9 @@ begin
|
|||||||
if not CheckPutSearchPath('source search path',OldPath,Options.GetSrcPath(false)) then
|
if not CheckPutSearchPath('source search path',OldPath,Options.GetSrcPath(false)) then
|
||||||
exit(false);
|
exit(false);
|
||||||
Options.UnitOutputDirectory := edtUnitOutputDir.Text;
|
Options.UnitOutputDirectory := edtUnitOutputDir.Text;
|
||||||
OldPath:=Options.GetParsedPath(pcosDebugPath,icoNone,false);
|
OldPath:=Options.GetDebugPath(false);
|
||||||
Options.DebugPath := edtDebugPath.Text;
|
Options.DebugPath := edtDebugPath.Text;
|
||||||
if not CheckPutSearchPath('debugger search path',OldPath,
|
if not CheckPutSearchPath('debugger search path',OldPath,Options.GetDebugPath(false)) then
|
||||||
Options.GetParsedPath(pcosDebugPath,icoNone,false))
|
|
||||||
then
|
|
||||||
exit(false);
|
exit(false);
|
||||||
|
|
||||||
i:=LCLWidgetTypeComboBox.Itemindex;
|
i:=LCLWidgetTypeComboBox.Itemindex;
|
||||||
|
Loading…
Reference in New Issue
Block a user