codetools: fixed CreateRelativePath

git-svn-id: trunk@28994 -
This commit is contained in:
mattias 2011-01-13 15:07:51 +00:00
parent ca536d0252
commit 4b32b87dde
4 changed files with 17 additions and 12 deletions
components/codetools
ide
lcl/include
packager

View File

@ -1464,10 +1464,12 @@ begin
if ((BaseDirPos>BaseDirLen) or (CmpBaseDirectory[BaseDirPos]=PathDelim))
and ((p>FileNameLength) or (CmpFilename[p]=PathDelim)) then
begin
// for example File=/a BaseDir=/a/b
inc(DirCount);
inc(BaseDirPos);
end else
end else begin
// for example File=/aa BaseDir=/ab
inc(UpDirCount);
end;
if DirCount=0 then exit;
if FilenameIsAbsolute(BaseDirectory) and (DirCount=1) then exit;

View File

@ -2027,33 +2027,33 @@ var
begin
// current path
CurrentPath:=ParsedOpts.GetParsedPIValue(Option);
{$IFDEF VerbosePkgUnitPath}
{ $IFDEF VerbosePkgUnitPath}
if Option=pcosUnitPath then
debugln('TBaseCompilerOptions.GetParsedPIPath GetParsedPIValue ',dbgsName(Self),' RelativeToBaseDir=',dbgs(RelativeToBaseDir),' CurrentPath="',CurrentPath,'" BaseDirectory="',BaseDirectory,'"');
{$ENDIF}
{ $ENDIF}
if RelativeToBaseDir then
CurrentPath:=CreateRelativeSearchPath(CurrentPath,BaseDirectory)
else
CurrentPath:=CreateAbsoluteSearchPath(CurrentPath,BaseDirectory);
{$IFDEF VerbosePkgUnitPath}
{ $IFDEF VerbosePkgUnitPath}
if Option=pcosUnitPath then
debugln('TBaseCompilerOptions.GetParsedPIPath Abs/Rel ',dbgsName(Self),' CurrentPath="',CurrentPath,'"');
{$ENDIF}
{ $ENDIF}
// inherited path
InheritedPath:=GetInheritedOption(InheritedOption,RelativeToBaseDir,
coptParsedPlatformIndependent);
{$IFDEF VerbosePkgUnitPath}
{ $IFDEF VerbosePkgUnitPath}
if Option=pcosUnitPath then
debugln('TBaseCompilerOptions.GetParsedPIPath Inherited ',dbgsName(Self),' InheritedPath="',InheritedPath,'"');
{$ENDIF}
{ $ENDIF}
Result:=MergeSearchPaths(CurrentPath,InheritedPath);
{$IFDEF VerbosePkgUnitPath}
{ $IFDEF VerbosePkgUnitPath}
if Option=pcosUnitPath then
debugln('TBaseCompilerOptions.GetParsedPIPath Total ',dbgsName(Self),' Result="',Result,'"');
{$ENDIF}
{ $ENDIF}
end;
function TBaseCompilerOptions.GetUnparsedPath(Option: TParsedCompilerOptString;

View File

@ -873,10 +873,12 @@ begin
if ((BaseDirPos>BaseDirLen) or (CmpBaseDirectory[BaseDirPos]=PathDelim))
and ((p>FileNameLength) or (CmpFilename[p]=PathDelim)) then
begin
// for example File=/a BaseDir=/a/b
inc(DirCount);
inc(BaseDirPos);
end else
end else begin
// for example File=/aa BaseDir=/ab
inc(UpDirCount);
end;
if DirCount=0 then exit;
if FilenameIsAbsolute(BaseDirectory) and (DirCount=1) then exit;

View File

@ -3670,6 +3670,7 @@ begin
MainUnitName:=lowercase(ExtractFileNameOnly((SrcFilename)));
UnitPath:=APackage.CompilerOptions.GetUnitPath(true,
coptParsedPlatformIndependent);
debugln(['TLazPackageGraph.WriteMakeFile UnitPath="',UnitPath,'" ']);
IncPath:=APackage.CompilerOptions.GetIncludePath(true,
coptParsedPlatformIndependent,false);
UnitOutputPath:=APackage.CompilerOptions.GetUnitOutPath(true,