FIX issue #19 where multiple widget values led to bad replacements in the command
[qgit4/redivivus.git] / qgit_inno_setup.iss
blob4a1b802fbe08701b0e76a14bfe77da8389b7125d
1 ; QGit installation script for Inno Setup compiler
3 ; QGit should be compiled with MSVC 2008, statically linked
4 ; to Qt4.3 or better Trolltech libraries and directory of
5 ; Visual C++ redistributable dll files copied under 'bin\'
6 ; directory
8 [Setup]
9 AppName=QGit
10 AppVerName=QGit version 2.10
11 DefaultDirName={pf}\QGit
12 DefaultGroupName=QGit
13 UninstallDisplayIcon={app}\qgit.exe
14 Compression=lzma
15 SolidCompression=yes
16 LicenseFile=COPYING.rtf
17 SetupIconFile=src\resources\qgit.ico
18 OutputDir=bin
19 OutputBaseFilename=qgit-2.3_win
21 [Files]
22 Source: "bin\qgit.exe"; DestDir: "{app}"
23 Source: "bin\qgit.exe.manifest"; DestDir: "{app}"
24 Source: "README_WIN.txt"; DestDir: "{app}"; Flags: isreadme
26 ; Directory of MSVC redistributable files must be copied under 'bin\'
27 ; before to run Inno Setup compiler or following line will error out
28 Source: "bin\Microsoft.VC90.CRT\*"; DestDir: "{app}\Microsoft.VC90.CRT"
30 [Tasks]
31 Name: desktopicon; Description: "Create a &desktop icon";
32 Name: winexplorer; Description: "Add ""QGit Here"" in Windows Explorer context menu";
34 [Registry]
35 Root: HKCU; Subkey: "Software\qgit"; Flags: uninsdeletekey
36 Root: HKCU; Subkey: "Software\qgit\qgit4"; ValueType: string; ValueName: "msysgit_exec_dir"; ValueData: "{code:GetMSysGitExecDir}";
38 ; Windows Explorer integration
39 Root: HKCU; Subkey: "SOFTWARE\Classes\Directory\shell\qgit"; Flags: uninsdeletekey; Tasks: winexplorer
40 Root: HKCU; Subkey: "SOFTWARE\Classes\Directory\shell\qgit"; ValueType: string; ValueName: ""; ValueData: "&QGit Here"; Tasks: winexplorer
41 Root: HKCU; Subkey: "SOFTWARE\Classes\Directory\shell\qgit\command"; ValueType: string; ValueName: ""; ValueData: "{app}\qgit.exe"; Tasks: winexplorer
43 [Dirs]
44 Name: {code:GetMSysGitExecDir}; Flags: uninsneveruninstall
46 [Icons]
47 Name: "{group}\QGit"; Filename: "{app}\qgit.exe"; WorkingDir: "%USERPROFILE%";
48 Name: "{group}\Uninstall QGit"; Filename: "{uninstallexe}"
49 Name: "{commondesktop}\QGit"; Filename: "{app}\qgit.exe"; WorkingDir: "%USERPROFILE%"; Tasks: desktopicon
51 [Code]
52 var
53 MSysGitDirPage: TInputDirWizardPage;
55 procedure InitializeWizard;
56 var
57 Key, Val: String;
59 begin
60 // Create msysgit directory find page
61 MSysGitDirPage := CreateInputDirPage(wpSelectProgramGroup,
62 'Select MSYSGIT Location', 'Where is MSYSGIT directory located?',
63 'Select where MSYSGIT directory is located, then click Next.',
64 False, '');
66 // Add item (with an empty caption)
67 MSysGitDirPage.Add('');
69 // Set initial value
70 Key := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1';
72 if RegQueryStringValue(HKEY_LOCAL_MACHINE, Key, 'InstallLocation', Val) then begin
73 MSysGitDirPage.Values[0] := Val;
74 end else
75 MSysGitDirPage.Values[0] := ExpandConstant('{pf}\Git');
77 end;
79 function NextButtonClick(CurPageID: Integer): Boolean;
80 var
81 BaseDir: String;
83 begin
84 // Validate pages before allowing the user to proceed }
85 if CurPageID = MSysGitDirPage.ID then begin
87 BaseDir := MSysGitDirPage.Values[0];
89 if FileExists(ExpandFileName(BaseDir + '\bin\git.exe')) then begin
90 Result := True;
92 end else if FileExists(ExpandFileName(BaseDir + '\..\bin\git.exe')) then begin // sub dir selected
93 MSysGitDirPage.Values[0] := ExpandFileName(BaseDir + '\..');
94 Result := True;
96 end else begin
97 MsgBox('Directory ''' + BaseDir + ''' does not seem the msysgit one, retry', mbError, MB_OK);
98 Result := False;
99 end;
101 end else
102 Result := True;
103 end;
105 function GetMSysGitExecDir(Param: String): String;
106 begin
107 Result := MSysGitDirPage.Values[0] + '\bin'; // already validated
108 end;