codetools: fixed CreateRelativePath

git-svn-id: trunk@28483 -
This commit is contained in:
mattias 2010-11-25 19:03:31 +00:00
parent 337ec99248
commit 0f237c154c
3 changed files with 7 additions and 6 deletions

View File

@ -420,12 +420,13 @@ function CompareCTCSVariables(const Left, Right: PCTCfgScriptVariable; out
Number:=Number div 10; Number:=Number div 10;
end; end;
end; end;
for i:=1 to Cnt do begin for i:=0 to Cnt-1 do begin
if p^<>s[i] then begin if p^<>s[i] then begin
Equal:=false; Equal:=false;
LeftIsLowerThanRight:=s[i]<p^; LeftIsLowerThanRight:=s[i]<p^;
exit; exit;
end; end;
inc(p);
end; end;
if p^=#0 then begin if p^=#0 then begin
Equal:=true; Equal:=true;
@ -444,6 +445,7 @@ begin
CheckCTCSVariable(Left); CheckCTCSVariable(Left);
CheckCTCSVariable(Right); CheckCTCSVariable(Right);
{$ENDIF} {$ENDIF}
//debugln(['CompareCTCSVariables AAA1 Left=',dbgs(Left),' Right=',dbgs(Right)]);
Result:=false; Result:=false;
Equal:=false; Equal:=false;
LeftIsLowerThanRight:=false; LeftIsLowerThanRight:=false;

View File

@ -1435,19 +1435,18 @@ begin
inc(BaseDirPos); inc(BaseDirPos);
end; end;
end; end;
UpDirCount:=0;
if ((BaseDirPos>BaseDirLen) or (CmpBaseDirectory[BaseDirPos]=PathDelim)) if ((BaseDirPos>BaseDirLen) or (CmpBaseDirectory[BaseDirPos]=PathDelim))
and ((p>FileNameLength) or (CmpFilename[p]=PathDelim)) then and ((p>FileNameLength) or (CmpFilename[p]=PathDelim)) then
begin begin
inc(DirCount); inc(DirCount);
inc(BaseDirPos); inc(BaseDirPos);
end; end else
inc(UpDirCount);
if DirCount=0 then exit; if DirCount=0 then exit;
if FilenameIsAbsolute(BaseDirectory) and (DirCount=1) then exit; if FilenameIsAbsolute(BaseDirectory) and (DirCount=1) then exit;
// calculate needed up directories // calculate needed up directories
UpDirCount:=0;
if (BaseDirPos<=BaseDirLen) and (CmpBaseDirectory[BaseDirPos]<>PathDelim) then
inc(UpDirCount);
while (BaseDirPos<=BaseDirLen) do begin while (BaseDirPos<=BaseDirLen) do begin
if (CmpBaseDirectory[BaseDirPos]=PathDelim) then if (CmpBaseDirectory[BaseDirPos]=PathDelim) then
begin begin

View File

@ -4313,7 +4313,7 @@ begin
end; end;
AFilename:=TrimFilename(AFilename); AFilename:=TrimFilename(AFilename);
ProjectPath:=ProjectDirectory; ProjectPath:=AppendPathDelim(ProjectDirectory);
if ProjectPath<>'' then begin if ProjectPath<>'' then begin
if Load then begin if Load then begin
// make filename absolute // make filename absolute