* look in main source dir instead of loaded_from unit dirs. The loaded_from dir is normally

already searched by the unit search path. And it prevented overriding the path where to
    look first for a unit. See bug #9664

git-svn-id: trunk@8828 -
This commit is contained in:
peter 2007-10-16 20:55:24 +00:00
parent 3f24d63176
commit 9ca132c61b

View File

@ -363,17 +363,20 @@ uses
{ try to find unit { try to find unit
1. look for ppu in cwd 1. look for ppu in cwd
2. look for ppu in outputpath if set, this is tp7 compatible (PFV) 2. look for ppu in outputpath if set, this is tp7 compatible (PFV)
3. look for the specified source file (from the uses line) 3. look for ppu in maindir
4. look for source in cwd 4. look for the specified source file (from the uses line)
5. look in same path as local unit 5. look for source in cwd
6. local unit pathlist 6. look for source in maindir
7. global unit pathlist } 7. local unit pathlist
8. global unit pathlist }
fnd:=false; fnd:=false;
if not onlysource then if not onlysource then
begin begin
fnd:=PPUSearchPath('.'); fnd:=PPUSearchPath('.');
if (not fnd) and (outputpath^<>'') then if (not fnd) and (outputpath^<>'') then
fnd:=PPUSearchPath(outputpath^); fnd:=PPUSearchPath(outputpath^);
if (not fnd) and Assigned(main_module) and (main_module.Path^<>'') then
fnd:=PPUSearchPath(main_module.Path^);
end; end;
if (not fnd) and (sourcefn^<>'') then if (not fnd) and (sourcefn^<>'') then
begin begin
@ -403,14 +406,10 @@ uses
end; end;
if not fnd then if not fnd then
fnd:=SourceSearchPath('.'); fnd:=SourceSearchPath('.');
if (not fnd) and Assigned(Loaded_From) then if (not fnd) and Assigned(main_module) and (main_module.Path^<>'') then
begin fnd:=SourceSearchPath(main_module.Path^);
fnd:=PPUSearchPath(Loaded_From.Path^); if (not fnd) and Assigned(loaded_from) then
if not fnd then fnd:=SearchPathList(loaded_from.LocalUnitSearchPath);
fnd:=SourceSearchPath(Loaded_From.Path^);
if not fnd then
fnd:=SearchPathList(Loaded_From.LocalUnitSearchPath);
end;
if not fnd then if not fnd then
fnd:=SearchPathList(UnitSearchPath); fnd:=SearchPathList(UnitSearchPath);