LazFileUtils: fix error in TryCreateRelativePath (it failed e.g with Dest=C:\ and Source=C:\foo), issue #27601

git-svn-id: branches/fixes_1_4@48129 -
This commit is contained in:
mattias 2015-03-04 15:26:02 +00:00
parent 103b55518d
commit 75846638ed
2 changed files with 9 additions and 6 deletions

View File

@ -323,7 +323,7 @@ begin
end;
//debugln('TryCreaterelativePath: SharedFolders = ',DbgS(SharedFolders));
if (SharedFolders = 0) and ((not IsAbs) or AlwaysRequireSharedBaseFolder) and not ((CmpDestLen = 0) and (CmpSourceLen = 0)) then
if (SharedFolders = 0) and ((not IsAbs) or AlwaysRequireSharedBaseFolder) and not ((CmpDestLen = 0) or (CmpSourceLen = 0)) then
begin
//debguln('TryCreaterelativePath: FAIL: IsAbs = ',DbgS(IsAs),' AlwaysRequireSharedBaseFolder = ',DbgS(AlwaysRequireSharedBaseFolder),
//' SharedFolders = 0, CmpDestLen = ',DbgS(cmpdestlen),' CmpSourceLen = ',DbgS(CmpSourceLen));

View File

@ -3098,11 +3098,14 @@ begin
if NewTargetDirectory <> '' then
switches := switches + ' '+PrepareCmdLineOption('-FE' + NewTargetDirectory);
NewTargetFileName := ExtractFileName(NewTargetFilename);
if (NewTargetFilename<>'')
and (NewTargetFilename<>ChangeFileExt(ExtractFileName(CurMainSrcFile),GetTargetFileExt))
then begin
// custom target => pass -o
switches := switches + ' '+PrepareCmdLineOption('-o' + NewTargetFileName);
if (NewTargetFilename<>'') then
begin
if (not TargetFilenameApplyConventions)
or (NewTargetFilename<>ChangeFileExt(ExtractFileName(CurMainSrcFile),GetTargetFileExt))
then begin
// custom target => pass -o
switches := switches + ' '+PrepareCmdLineOption('-o' + NewTargetFileName);
end;
end;
end;
end;