From 75846638edba1ebace40f02f66e7b42af112e530 Mon Sep 17 00:00:00 2001 From: mattias Date: Wed, 4 Mar 2015 15:26:02 +0000 Subject: [PATCH] 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 - --- components/lazutils/lazfileutils.inc | 2 +- ide/compileroptions.pp | 13 ++++++++----- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/components/lazutils/lazfileutils.inc b/components/lazutils/lazfileutils.inc index 7fb4b03b7d..3f3ef37c0d 100644 --- a/components/lazutils/lazfileutils.inc +++ b/components/lazutils/lazfileutils.inc @@ -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)); diff --git a/ide/compileroptions.pp b/ide/compileroptions.pp index 58dfc5cc24..9189ae76ce 100644 --- a/ide/compileroptions.pp +++ b/ide/compileroptions.pp @@ -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;