forked from eraxillan/qgit5
-
Notifications
You must be signed in to change notification settings - Fork 0
/
qgit_inno_setup.iss
114 lines (92 loc) · 3.7 KB
/
qgit_inno_setup.iss
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
;
; QGit installation script for Inno Setup compiler
;
; QGit should be compiled with MSVC 2013 and dynamically linked to Qt 4.8.0 or Qt 5.0.3
;
[Setup]
AppName=QGit
AppVerName=QGit version 2.6
DefaultDirName={pf}\QGit
DefaultGroupName=QGit
UninstallDisplayIcon={app}\qgit.exe
Compression=lzma
SolidCompression=yes
LicenseFile=${CMAKE_CURRENT_SOURCE_DIR}\COPYING.rtf
SetupIconFile=${CMAKE_CURRENT_SOURCE_DIR}\src\resources\qgit.ico
OutputDir=Release
OutputBaseFilename=qgit-2.6_win
[Files]
; QGit binaries
Source: "Release\qgit.exe"; DestDir: "{app}"
; MSVC runtime libraries
Source: "Release\msvcp120.dll"; DestDir: "{app}"
Source: "Release\msvcr120.dll"; DestDir: "{app}"
; Qt5 libraries
Source: "Release\Qt5Core.dll"; DestDir: "{app}"
Source: "Release\Qt5Gui.dll"; DestDir: "{app}"
Source: "Release\Qt5Widgets.dll"; DestDir: "{app}"
; Qt5 plugins
Source: "Release\platforms\qwindows.dll"; DestDir: "{app}\platforms"
; Documentation
Source: "${CMAKE_CURRENT_SOURCE_DIR}\README_WIN.txt"; DestDir: "{app}"; Flags: isreadme
Source: "${CMAKE_CURRENT_SOURCE_DIR}\COPYING.rtf"; DestDir: "{app}";
[Tasks]
Name: desktopicon; Description: "Create a &desktop icon";
Name: winexplorer; Description: "Add ""QGit Here"" in Windows Explorer context menu";
[Registry]
Root: HKCU; Subkey: "Software\qgit"; Flags: uninsdeletekey
Root: HKCU; Subkey: "Software\qgit\qgit4"; ValueType: string; ValueName: "msysgit_exec_dir"; ValueData: "{code:GetMSysGitExecDir}";
; Windows Explorer integration
Root: HKCU; Subkey: "SOFTWARE\Classes\Directory\shell\qgit"; Flags: uninsdeletekey; Tasks: winexplorer
Root: HKCU; Subkey: "SOFTWARE\Classes\Directory\shell\qgit"; ValueType: string; ValueName: ""; ValueData: "&QGit Here"; Tasks: winexplorer
Root: HKCU; Subkey: "SOFTWARE\Classes\Directory\shell\qgit\command"; ValueType: string; ValueName: ""; ValueData: "{app}\qgit.exe"; Tasks: winexplorer
[Dirs]
Name: {code:GetMSysGitExecDir}; Flags: uninsneveruninstall
[Icons]
Name: "{group}\QGit"; Filename: "{app}\qgit.exe"; WorkingDir: "%USERPROFILE%";
Name: "{group}\Uninstall QGit"; Filename: "{uninstallexe}"
Name: "{commondesktop}\QGit"; Filename: "{app}\qgit.exe"; WorkingDir: "%USERPROFILE%"; Tasks: desktopicon
[Code]
var
MSysGitDirPage: TInputDirWizardPage;
procedure InitializeWizard;
var
Key, Val: String;
begin
// Create msysgit directory find page
MSysGitDirPage := CreateInputDirPage(wpSelectProgramGroup,
'Select MSYSGIT Location', 'Where is MSYSGIT directory located?',
'Select where MSYSGIT directory is located, then click Next.',
False, '');
// Add item (with an empty caption)
MSysGitDirPage.Add('');
// Set initial value
Key := 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Git_is1';
if RegQueryStringValue(HKEY_LOCAL_MACHINE, Key, 'InstallLocation', Val) then begin
MSysGitDirPage.Values[0] := Val;
end else
MSysGitDirPage.Values[0] := ExpandConstant('{pf}\Git');
end;
function NextButtonClick(CurPageID: Integer): Boolean;
var
BaseDir: String;
begin
// Validate pages before allowing the user to proceed
if CurPageID = MSysGitDirPage.ID then begin
BaseDir := MSysGitDirPage.Values[0];
if FileExists(ExpandFileName(BaseDir + '\bin\git.exe')) then begin
Result := True;
end else if FileExists(ExpandFileName(BaseDir + '\..\bin\git.exe')) then begin // sub dir selected
MSysGitDirPage.Values[0] := ExpandFileName(BaseDir + '\..');
Result := True;
end else begin
MsgBox('Directory ''' + BaseDir + ''' does not seem the msysgit one, retry', mbError, MB_OK);
Result := False;
end;
end else
Result := True;
end;
function GetMSysGitExecDir(Param: String): String;
begin
Result := MSysGitDirPage.Values[0] + '\bin'; // already validated
end;