diff --git a/components/codetools/customcodetool.pas b/components/codetools/customcodetool.pas index 5ee3f5af36..fe06954c5f 100644 --- a/components/codetools/customcodetool.pas +++ b/components/codetools/customcodetool.pas @@ -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 diff --git a/examples/idequickfix/quickfixexample.lpk b/examples/idequickfix/quickfixexample.lpk index 84a8140ef4..7870279525 100644 --- a/examples/idequickfix/quickfixexample.lpk +++ b/examples/idequickfix/quickfixexample.lpk @@ -1,6 +1,6 @@ - + @@ -24,14 +24,14 @@ - + - + diff --git a/ide/checkcompileropts.pas b/ide/checkcompileropts.pas index 0d88ae8f03..afb388252e 100644 --- a/ide/checkcompileropts.pas +++ b/ide/checkcompileropts.pas @@ -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 diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index bf095b0b3f..6d5cfdb9b6 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -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 diff --git a/ide/compileroptionsdlg.pp b/ide/compileroptionsdlg.pp index 02368372a4..83d496f23f 100644 --- a/ide/compileroptionsdlg.pp +++ b/ide/compileroptionsdlg.pp @@ -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;