forked from pgmodeler/pgmodeler
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpgmodeler.iss
130 lines (113 loc) · 4.78 KB
/
pgmodeler.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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
; Created with Inno Setup (http://www.jrsoftware.org/isinfo.php)
#define MyAppName "pgModeler - PostgreSQL Database Modeler"
#define MyAppMenuGroup "pgModeler"
#define MyAppVersion "0.5.1_r1"
#define MyAppPublisher "pgModeler Project"
#define MyAppURL "http://www.pgmodeler.com.br/"
#define MyAppExeName "pgmodeler.exe"
[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={{8978809A-8AA1-4DE8-A4B8-058F2CE7B9E7}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={pf}\pgmodeler
DefaultGroupName={#MyAppName}
AllowNoIcons=yes
LicenseFile=.\build\LICENSE
OutputDir=.\
;OutputBaseFilename=pgmodeler-{#MyAppVersion}-windows
OutputBaseFilename=pgmodeler
Compression=lzma
SolidCompression=yes
ChangesEnvironment=true
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "quicklaunchicon"; Description: "{cm:CreateQuickLaunchIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked; OnlyBelowVersion: 0,6.1
[Files]
Source: ".\build\pgmodeler.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: ".\build\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:ProgramOnTheWeb,{#MyAppMenuGroup}}"; Filename: "{#MyAppURL}"
Name: "{group}\{cm:UninstallProgram,{#MyAppMenuGroup}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\{#MyAppMenuGroup}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\{#MyAppMenuGroup}"; Filename: "{app}\{#MyAppExeName}"; Tasks: quicklaunchicon
[CustomMessages]
qt5notfound=Qt5 framework was not found on this system. Please download and install Qt5 framework and try to run this setup again.%n%nNOTE: Read "Installation" section on pgmodeler.com.br/wiki for details.%n%nSetup will now abort!
pgsqlnotfound=PostgreSQL not found on this system. Please download and install PostgreSQL database and try to run this setup again.%n%nNOTE: Read "Installation" section on pgmodeler.com.br/wiki for details.%n%nSetup will now abort!
; function InitializeSetup(): Boolean;
; var
; ResultCode: Integer;
; Qt5Installed : Boolean;
; PgSQLInstalled : Boolean;
; begin
; Result:=true;
; Qt5Installed := Exec('qmake.exe', '--version', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
; PgSQLInstalled := Exec('pg_config.exe', '--version', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
; if Qt5Installed = false then
; begin
; MsgBox(ExpandConstant('{cm:qt5notfound}'), mbConfirmation, MB_OK)
; Result:=false;
; end
; else if PgSQLInstalled = false then
; begin
; MsgBox(ExpandConstant('{cm:pgsqlnotfound}'), mbConfirmation, MB_OK)
; Result:=false;
; end;
; end;
; end.
[code]
procedure SetEnv(EnvName, EnvValue: String; IsInstall: Boolean);
var
OrgValue:String;
OrgLen:Integer;
EnvValuePos:Integer;
EnvValueLen:Integer;
begin
RegQueryStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', EnvName, OrgValue);
OrgValue:=Trim(OrgValue);
OrgLen:=length(OrgValue);
EnvValuePos:=pos(Uppercase(EnvValue),Uppercase(OrgValue));
EnvValueLen:=length(EnvValue);
if IsInstall then
begin
if OrgLen>0 then EnvValue:=';'+EnvValue;
if EnvValuePos=0 then Insert(EnvValue,OrgValue,OrgLen+1);
end
else
begin
if EnvValuePos>0 then Delete(OrgValue,EnvValuePos,EnvValueLen);
if length(OrgValue)=0 then
begin
RegDeleteValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment',EnvName);
exit;
end;
end;
StringChange(OrgValue,';;',';');
RegWriteStringValue(HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment', EnvName, OrgValue);
end;
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep=ssInstall then
begin
SetEnv('Path',ExpandConstant('{app}'),true);
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usUninstall then
begin
SetEnv('Path',ExpandConstant('{app}'),false);
end;
end;