codetools: fixed result of FindCompiledUnitInCompletePath

git-svn-id: trunk@30840 -
This commit is contained in:
mattias 2011-05-21 18:21:04 +00:00
parent cf9d1a8a39
commit 8865170255
2 changed files with 18 additions and 8 deletions

View File

@ -290,7 +290,7 @@ var
p1: PChar absolute Data1;
p2: PChar absolute Data2;
begin
while (FPUpChars[p1^]=FPUpChars[p2^]) and (p1^<>#0) and (MaxCount>0) do begin
while (MaxCount>0) and (FPUpChars[p1^]=FPUpChars[p2^]) and (p1^<>#0) do begin
inc(p1);
inc(p2);
dec(MaxCount);
@ -1084,17 +1084,19 @@ begin
end else begin
// unit not found
end;
//debugln(['TCTDirectoryCache.FindCompiledUnitInCompletePath Cached AnUnitname="',AnUnitname,'" Result="',Result,'"']);
end else begin
// not found in cache -> search
// search in unit path
UnitPath:=Strings[ctdcsUnitPath];
Result:=Pool.FindCompiledUnitInPath(Directory,UnitPath,AnUnitname,AnyCase);
//debugln(['TCTDirectoryCache.FindCompiledUnitInCompletePath CurDir="',CurDir,'" UnitPath="',UnitPath,'" AnUnitname="',AnUnitname,'" Result=',Result]);
//debugln(['TCTDirectoryCache.FindCompiledUnitInCompletePath CurDir="',Directory,'" UnitPath="',UnitPath,'" AnUnitname="',AnUnitname,'" Result=',Result]);
if Result='' then begin
// search in unit set
Result:=FindCompiledUnitInUnitSet(AnUnitname);
end;
//if (Result='') then debugln(['TCTDirectoryCache.FindCompiledUnitInCompletePath CurDir="',Directory,'" UnitPath="',UnitPath,'" AnUnitname="',AnUnitname,'" Result=',Result]);
AddToCache(UnitSrc,AnUnitname,Result);
end;
@ -1410,7 +1412,10 @@ begin
if FilenameIsAbsolute(CurPath) then begin
Cache:=GetCache(CurPath,true,false);
Result:=Cache.FindFile(ShortFilename,SearchCase);
if Result<>'' then exit;
if Result<>'' then begin
Result:=AppendPathDelim(CurPath)+Result;
exit;
end;
end;
end;
StartPos:=p+1;

View File

@ -813,13 +813,16 @@ begin
BaseDir,AnUnitName);
if (Item.PPUFile='') and (OutputDir<>'') then begin
// fallback: search in output directory
Item.PPUFile:=SearchPascalFileInDir(AnUnitName+'.ppu',OutputDir,
ctsfcLoUpCase);
Item.PPUFile:=CodeToolBoss.DirectoryCachePool.FindCompiledUnitInPath(
OutputDir,'.',AnUnitName,false);
end;
Item.OFile:=ChangeFileExt(Item.PPUFile,'.o');
if not FileExistsCached(Item.PPUFile) then
Item.PPUFile:=PPUFileNotFound
else
if not FileExistsCached(Item.PPUFile) then begin
if Item.PPUFile<>'' then begin
debugln(['TPPUListDialog.OnIdle warning: ppu file gone from disk: ',Item.PPUFile]);
end;
Item.PPUFile:=PPUFileNotFound;
end else
Item.PPUFileSize:=FileSize(Item.PPUFile);
if not FileExistsCached(Item.OFile) then
Item.OFile:=PPUFileNotFound
@ -855,6 +858,8 @@ begin
end else begin
debugln(['TPPUListDialog.OnIdle failed loading ',Item.PPUFile]);
end;
end else begin
//debugln(['TPPUListDialog.OnIdle PPU not found of ',AnUnitName]);
end;
if (not Scanned) and (Item.SrcFile<>'') then begin
//debugln(['TPPUListDialog.OnIdle search used units of source "',Item.SrcFile,'"']);