-
Notifications
You must be signed in to change notification settings - Fork 6
/
lumberjack.iss
147 lines (125 loc) · 5.6 KB
/
lumberjack.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
#define MyBaseAppId "{BA395D89-E5A9-441A-8869-E9151B8EACE6}"
#define MyAppName "Lumberjack"
#define MyAppPublisher "Lumberjack"
#define MyAppURL "https://github.com/SchrodingersGat/lumberjack/"
#define MyAppExeName "Lumberjack.exe"
#define MyAppVersion ReadIni("resource/version.ini", "General", "version", "0.0.0");
#define BuildDir "build/release"
[Setup]
; NOTE: The value of AppId uniquely identifies this application. Do not use the same AppId value in installers for other applications.
; (To generate a new GUID, click Tools | Generate GUID inside the IDE.)
AppId={code:GetAppId}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DisableProgramGroupPage=yes
LicenseFile=README.md
; Remove the following line to run in administrative install mode (install for all users.)
PrivilegesRequired=lowest
PrivilegesRequiredOverridesAllowed=dialog
UsePreviousPrivileges=no
UsePreviousLanguage=no
OutputBaseFilename=lumberjack_{#MyAppVersion}
SetupIconFile=logo\lumberjack.ico
Compression=lzma
SolidCompression=yes
WizardStyle=modern
ArchitecturesInstallIn64BitMode=x64
ArchitecturesAllowed=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
; Application executable
Source: "{#BuildDir}\lumberjack.exe"; DestDir: "{app}"; Flags: ignoreversion
; DLL files
Source: "{#BuildDir}\*.dll"; DestDir: "{app}"; Flags: ignoreversion
; Plugins
Source: "plugins\build\release\*.dll"; DestDir: "{app}\plugins"; Flags: ignoreversion
; Qt directories
Source: "{#BuildDir}\generic\*"; DestDir: "{app}\generic"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\iconengines\*"; DestDir: "{app}\iconengines"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\imageformats\*"; DestDir: "{app}\imageformats"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\networkinformation\*"; DestDir: "{app}\networkinformation"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\platforms\*"; DestDir: "{app}\platforms"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\styles\*"; DestDir: "{app}\styles"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\tls\*"; DestDir: "{app}\tls"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "{#BuildDir}\translations\*"; DestDir: "{app}\translations"; Flags: ignoreversion recursesubdirs createallsubdirs
[Icons]
Name: "{autoprograms}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
// The following code is to optionally allow multiple versions to be
// installed on the one computer. If a previous installation is
// detected, a dialogue box asks the user whether they want to overwrite the
// existing installation, or install a new one.
var
AppId: string;
DefaultDirName: string;
// Getter for AppId
function GetAppId(Param: string): string;
begin
Result := AppId;
Log('AppId = ' + Result);
end;
// Getter for DefaultDirName
function GetDefaultDirName(Param: string): string;
begin
Result := DefaultDirName;
Log('DefaultDirName = ' + Result);
end;
// Impletement the event function InitializeSetup. This is called by Inno
// Setup "during Setup's initialisation".
function InitializeSetup(): Boolean;
var
PrevVersion: string;
CurVersion: string;
Message: string;
R: Integer;
begin
CurVersion := '{#MyAppVersion}';
Log(Format('Installing "%s"', [CurVersion]));
// Returning True means that installation will proceed
Result := True;
AppId := '{#MyBaseAppId}';
DefaultDirName := ExpandConstant('{autopf}\Lumberjack\{#MyAppName}');
// Look in the registry to see if program is already installed
if RegQueryStringValue(HKLM, 'Software\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) or
RegQueryStringValue(HKCU, 'SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) or
RegQueryStringValue(HKLM, 'Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) or
RegQueryStringValue(HKCU, 'SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{#MyBaseAppId}_is1', 'DisplayVersion', PrevVersion) then
begin
Message :=
Format(
'Version is %s already installed. Do you want to upgrade to %s?'#13#10#13#10+
'Press Yes, to replace %0:s with %1:s.'#13#10+
'Press No, to keep %0:s and add separate installation of %1:s.'#13#10, [
PrevVersion, CurVersion]);
R := MsgBox(Message, mbConfirmation, MB_YESNOCANCEL);
if R = IDYES then
begin
Log('User chose to replace previous installation');
end
else if R = IDNO then
begin
AppId := AppId + CurVersion;
DefaultDirName := DefaultDirName + ' ' + CurVersion;
Log('User chose to install new copy - using ID ' + AppId);
end
else
begin
Log('User chose to cancel installation');
// Returning False will cancel the installation
Result := False;
end;
end;
end;