From 88d00ef3312cb65dbee92f3917f670d1edfcb559 Mon Sep 17 00:00:00 2001 From: pierre Date: Thu, 17 Sep 2015 21:23:11 +0000 Subject: [PATCH] Merged revision 29476 from http://svn.freepascal.org/svn/fpc/trunk ------------------------------------------------------------------------ r29476 | pierre | 2015-01-15 17:53:58 +0100 (Thu, 15 Jan 2015) | 1 line Changed paths: M /trunk/ide/fpini.pas Avoid CopyFile over itself fp.cfg after copying fp.ini, thus avoiding misleading ErrorBox ------------------------------------------------------------------------ git-svn-id: branches/fixes_3_0@31753 - --- ide/fpini.pas | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/ide/fpini.pas b/ide/fpini.pas index 82fc7182ae..a4ede2221b 100644 --- a/ide/fpini.pas +++ b/ide/fpini.pas @@ -32,6 +32,7 @@ procedure SetPrinterDevice(const Device: string); implementation uses + sysutils, { used for SameFileName function } Dos,Objects,Drivers, FVConsts, Version, @@ -233,10 +234,17 @@ begin ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+IniName),nil) else IniFileName:=CurDir+IniName; - if CopyFile(SwitchesPath,CurDir+SwitchesName)=false then - ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+SwitchesName),nil) - else - SwitchesPath:=CurDir+SwitchesName; + { copy also SwitchesPath to current dir, but only if + 1) SwitchesPath exists + 2) SwitchesPath is different from CurDir+SwitchesName } + if ExistsFile(SwitchesPath) and + not SameFileName(SwitchesPath,CurDir+SwitchesName) then + begin + if CopyFile(SwitchesPath,CurDir+SwitchesName)=false then + ErrorBox(FormatStrStr(msg_errorwritingfile,CurDir+SwitchesName),nil) + else + SwitchesPath:=CurDir+SwitchesName; + end; end; end else