diff contrib/win32/mercurial.iss @ 7662:8aa338cd0df3

Update mercurial.ini file packaged in win32 installer Update contrib/win32/mercurial.ini file with contrib/sample.hgrc content and append contrib/mergetools.hgrc content during installation
author Pascal Quantin <pascal.quantin@wavecom.com>
date Sat, 17 Jan 2009 15:23:13 +0100
parents 25ac72ca68f6
children b0a0eb28a933
line wrap: on
line diff
--- a/contrib/win32/mercurial.iss	Sat Jan 17 15:19:41 2009 +0100
+++ b/contrib/win32/mercurial.iss	Sat Jan 17 15:23:13 2009 +0100
@@ -1,8 +1,7 @@
 ; Script generated by the Inno Setup Script Wizard.
 ; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
-
 [Setup]
-AppCopyright=Copyright 2005-2008 Matt Mackall and others
+AppCopyright=Copyright 2005-2009 Matt Mackall and others
 AppName=Mercurial
 AppVerName=Mercurial snapshot
 InfoAfterFile=contrib/win32/postinstall.txt
@@ -18,7 +17,7 @@
 DefaultDirName={pf}\Mercurial
 SourceDir=..\..
 VersionInfoDescription=Mercurial distributed SCM
-VersionInfoCopyright=Copyright 2005-2008 Matt Mackall and others
+VersionInfoCopyright=Copyright 2005-2009 Matt Mackall and others
 VersionInfoCompany=Matt Mackall and others
 InternalCompressLevel=max
 SolidCompression=true
@@ -32,7 +31,8 @@
 Source: contrib\vim\*.*; DestDir: {app}/Contrib/Vim
 Source: contrib\zsh_completion; DestDir: {app}/Contrib
 Source: contrib\win32\ReadMe.html; DestDir: {app}; Flags: isreadme
-Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Flags: confirmoverwrite
+Source: contrib\mergetools.hgrc; DestDir: {tmp};
+Source: contrib\win32\mercurial.ini; DestDir: {app}; DestName: Mercurial.ini; Check: CheckFile; AfterInstall: ConcatenateFiles;
 Source: contrib\win32\postinstall.txt; DestDir: {app}; DestName: ReleaseNotes.txt
 Source: dist\hg.exe; DestDir: {app}; AfterInstall: Touch('{app}\hg.exe.local')
 Source: dist\library.zip; DestDir: {app}
@@ -64,8 +64,32 @@
 
 [UninstallDelete]
 Type: files; Name: "{app}\hg.exe.local"
+[Code]
+var
+  WriteFile: Boolean;
+  CheckDone: Boolean;
 
-[Code]
+function CheckFile(): Boolean;
+begin
+  if not CheckDone then begin
+    WriteFile := True;
+    if FileExists(ExpandConstant(CurrentFileName)) then begin
+        WriteFile := MsgBox('' + ExpandConstant(CurrentFileName) + '' #13#13 'The file already exists.' #13#13 'Would you like Setup to overwrite it?', mbConfirmation, MB_YESNO) = idYes;
+    end;
+    CheckDone := True;
+  end;
+  Result := WriteFile;
+end;
+
+procedure ConcatenateFiles();
+var
+  MergeConfigs: TArrayOfString;
+begin
+  if LoadStringsFromFile(ExpandConstant('{tmp}\mergetools.hgrc'),MergeConfigs) then begin
+    SaveStringsToFile(ExpandConstant(CurrentFileName),MergeConfigs,True);
+  end;
+end;
+
 procedure Touch(fn: String);
 begin
   SaveStringToFile(ExpandConstant(fn), '', False);