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

View File

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