From 8865170255556e8e5a2259402675e61d0524be4a Mon Sep 17 00:00:00 2001 From: mattias Date: Sat, 21 May 2011 18:21:04 +0000 Subject: [PATCH] codetools: fixed result of FindCompiledUnitInCompletePath git-svn-id: trunk@30840 - --- components/codetools/directorycacher.pas | 11 ++++++++--- components/codetools/ide/ppulistdlg.pas | 15 ++++++++++----- 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/components/codetools/directorycacher.pas b/components/codetools/directorycacher.pas index 1e16afd83a..52be374645 100644 --- a/components/codetools/directorycacher.pas +++ b/components/codetools/directorycacher.pas @@ -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; diff --git a/components/codetools/ide/ppulistdlg.pas b/components/codetools/ide/ppulistdlg.pas index 4679375da2..23a3ae0a6c 100644 --- a/components/codetools/ide/ppulistdlg.pas +++ b/components/codetools/ide/ppulistdlg.pas @@ -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,'"']);