mirror of
https://gitlab.com/freepascal.org/lazarus/lazarus.git
synced 2025-11-21 09:42:12 +01:00
IDE: improve message cant find unit: check if ppu is there
git-svn-id: trunk@36467 -
This commit is contained in:
parent
7482e8c614
commit
da7b36da06
@ -286,6 +286,9 @@ var
|
|||||||
NewFilename: String;
|
NewFilename: String;
|
||||||
Tool: TCodeTool;
|
Tool: TCodeTool;
|
||||||
Caret: TCodeXYPosition;
|
Caret: TCodeXYPosition;
|
||||||
|
Dir: String;
|
||||||
|
PPUFilename: String;
|
||||||
|
s: String;
|
||||||
begin
|
begin
|
||||||
if Step<>imqfoImproveMessage then exit;
|
if Step<>imqfoImproveMessage then exit;
|
||||||
//DebugLn('QuickFixUnitNotFoundPosition ');
|
//DebugLn('QuickFixUnitNotFoundPosition ');
|
||||||
@ -296,6 +299,8 @@ begin
|
|||||||
end;
|
end;
|
||||||
MissingUnitname:=REVar(1);
|
MissingUnitname:=REVar(1);
|
||||||
CodeBuf:=nil;
|
CodeBuf:=nil;
|
||||||
|
Dir:=TrimFilename(Msg.Directory);
|
||||||
|
UsedByUnit:='';
|
||||||
if REMatches(Msg.Msg,'Can''t find unit ([a-z_.0-9]+) used by ([a-z_.0-9]+)','I')
|
if REMatches(Msg.Msg,'Can''t find unit ([a-z_.0-9]+) used by ([a-z_.0-9]+)','I')
|
||||||
then begin
|
then begin
|
||||||
UsedByUnit:=REVar(2);
|
UsedByUnit:=REVar(2);
|
||||||
@ -304,12 +309,12 @@ begin
|
|||||||
begin
|
begin
|
||||||
// the message belongs to another unit
|
// the message belongs to another unit
|
||||||
NewFilename:='';
|
NewFilename:='';
|
||||||
if FilenameIsAbsolute(Msg.Directory) then
|
if FilenameIsAbsolute(Dir) then
|
||||||
begin
|
begin
|
||||||
// For example: /path/laz/main.pp(1,1) Fatal: Can't find unit lazreport used by lazarus
|
// For example: /path/laz/main.pp(1,1) Fatal: Can't find unit lazreport used by lazarus
|
||||||
// => search source lazarus in directory
|
// => search source lazarus in directory
|
||||||
NewFilename:=CodeToolBoss.DirectoryCachePool.FindUnitInDirectory(
|
NewFilename:=CodeToolBoss.DirectoryCachePool.FindUnitInDirectory(
|
||||||
Msg.Directory,UsedByUnit,true);
|
Dir,UsedByUnit,true);
|
||||||
end;
|
end;
|
||||||
if NewFilename='' then begin
|
if NewFilename='' then begin
|
||||||
NewFilename:=LazarusIDE.FindUnitFile(UsedByUnit);
|
NewFilename:=LazarusIDE.FindUnitFile(UsedByUnit);
|
||||||
@ -345,10 +350,23 @@ begin
|
|||||||
if (Msg.Directory<>'') and (FilenameIsAbsolute(Msg.Directory)) then
|
if (Msg.Directory<>'') and (FilenameIsAbsolute(Msg.Directory)) then
|
||||||
NewFilename:=CreateRelativePath(NewFilename,Msg.Directory);
|
NewFilename:=CreateRelativePath(NewFilename,Msg.Directory);
|
||||||
Msg.SetSourcePosition(NewFilename,Caret.Y,Caret.X);
|
Msg.SetSourcePosition(NewFilename,Caret.Y,Caret.X);
|
||||||
|
Dir:=TrimFilename(Msg.Directory);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
if FilenameIsAbsolute(Dir) then begin
|
||||||
|
PPUFilename:=CodeToolBoss.DirectoryCachePool.FindCompiledUnitInCompletePath(
|
||||||
|
Dir,MissingUnitname);
|
||||||
|
if PPUFilename<>'' then begin
|
||||||
|
// there is a ppu file, but the compiler didn't like it
|
||||||
|
// => change message
|
||||||
|
s:='Fatal: unit '+MissingUnitname;
|
||||||
|
if UsedByUnit<>'' then
|
||||||
|
s+=' used by '+UsedByUnit;
|
||||||
|
s+=' needs rebuilding. ppu='+CreateRelativePath(PPUFilename,Dir);
|
||||||
|
Msg.Msg:=s;
|
||||||
|
end;
|
||||||
|
end;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
{ TQuickFixLinkerUndefinedReference }
|
{ TQuickFixLinkerUndefinedReference }
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user