This repository was archived by the owner on Feb 28, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPABCRobocode.iss
More file actions
145 lines (116 loc) · 4.22 KB
/
PABCRobocode.iss
File metadata and controls
145 lines (116 loc) · 4.22 KB
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
; Ñêðèïò ñîçäàíèÿ óñòàíîâùèêà PascalABC.NET Robocode
; Áèðþêîâ À.Ñ.
; 2016
#define MyAppName "PascalABC.NET Robocode"
#define MyAppVersion "0.3"
#define MyAppPublisher "MMCS"
#define MyAppURL "http://pascalabc.net/"
#define PABCStartMenu "PascalABC.NET"
#define PABCWorkINI "pabcworknet.ini"
#define RobocodeInstallPrefix "Robocode"
#define MinJRE "1.6"
#define WebJRE "https://java.com"
[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={{9B10DB3F-AA15-4349-A290-2CC323514250}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppVerName={#MyAppName} {#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
AppReadmeFile={#MyAppURL}
CreateAppDir=yes
LicenseFile=robocode/license/epl-v10.txt
DefaultDirName=/
DisableDirPage=yes
DisableProgramGroupPage=auto
DefaultGroupName={#PABCStartMenu}\{#RobocodeInstallPrefix}
OutputBaseFilename={#MyAppName}-{#MyAppVersion}-setup
Compression=lzma
SolidCompression=yes
PrivilegesRequired=lowest
OutputDir=/
[Files]
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
Source: "robocode/*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 0,5.01
Source: "robopascal/*"; DestDir: "{app}/robopascal"; Flags: ignoreversion recursesubdirs createallsubdirs; MinVersion: 0,5.01
[Icons]
; Ìåíþ Ïóñê
Name: "{group}\Çàïóñòèòü Robocode"; Filename: "{app}/libs/robopascal-runner.exe"; WorkingDir: "{app}"; Comment: "{cm:RunRobocode}"; IconFilename: "{app}/robocode.ico"
Name: "{group}\Óäàëèòü PascalABC.NET Robocode"; Filename: "{uninstallexe}"
; Ðàáî÷èé ñòîë
Name: "{userdesktop}\Çàïóñòèòü Robocode"; Filename: "{app}/libs/robopascal-runner.exe"; WorkingDir: "{app}"; Comment: "{cm:RunRobocode}"; IconFilename: "{app}/robocode.ico"
[Code]
var
InstallDir: String;
function GetPABCPath: String;
var Path: String;
begin
if RegQueryStringValue(HKEY_CURRENT_USER, 'SOFTWARE\PascalABC.NET', 'Install Directory', Path) then
begin
Result := Path;
end;
end;
function IsJREInstalled: Boolean;
var
JREVersion: string;
begin
Result := RegQueryStringValue(HKLM32, 'Software\JavaSoft\Java Runtime Environment',
'CurrentVersion', JREVersion);
if not Result and IsWin64 then
Result := RegQueryStringValue(HKLM64, 'Software\JavaSoft\Java Runtime Environment',
'CurrentVersion', JREVersion);
if Result then
Result := CompareStr(JREVersion, '{#MinJRE}') >= 0;
end;
function IsPascalInstalled: Boolean;
begin
Result := GetPABCPath <> '';
end;
function InitializeSetup: Boolean;
var
WorkPath: AnsiString;
ErrorCode: Integer;
begin
Result := True;
if not IsPascalInstalled then
begin
if MsgBox(ExpandConstant('{cm:PascalNotFound}'), mbConfirmation, MB_YESNO) = IDYES then
begin
Result := False;
ShellExec('', '{#MyAppURL}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
if not IsJREInstalled then
begin
if MsgBox(ExpandConstant('{cm:JavaNotFound}'), mbConfirmation, MB_YESNO) = IDYES then
begin
ShellExec('', '{#WebJRE}', '', '', SW_SHOWNORMAL, ewNoWait, ErrorCode);
end;
end;
// Óñòàíàâëèâàåì ïóòü óñòàíîâêè â PABCWork.NET
if not LoadStringFromFile(GetPABCPath + '/' + '{#PABCWorkINI}', WorkPath) then
begin
Result := False;
MsgBox(ExpandConstant('{cm:PascalNotFound}'), mbInformation, MB_OK); // TODO: äðóãàÿ îøèáêà
end;
InstallDir := WorkPath + '/' + '{#RobocodeInstallPrefix}';
end;
procedure InitializeWizard();
begin
WizardForm.DirEdit.Text := InstallDir;
end;
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "russian"; MessagesFile: "compiler:Languages\Russian.isl"
[CustomMessages]
english.PascalNotFound=PascalABC.NET not found! Do you want to download it now?
russian.PascalNotFound=PascalABC.NET íå íàéäåí! Ïåðåéòè íà ñàéò äëÿ çàãðóçêè?
english.JavaNotFound=JRE not found! Do you want to download it now?
russian.JavaNotFound=JRE íå íàéäåí! Ïåðåéòè íà ñàéò äëÿ çàãðóçêè?
russian.RunRobocode=Çàïóñòèòü Robocode
english.RunRobocode=Run Robocode