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