-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathkaboom_setup.iss
93 lines (83 loc) · 3.08 KB
/
kaboom_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
; Script generated by the Inno Setup Script Wizard.
; SEE THE DOCUMENTATION FOR DETAILS ON CREATING INNO SETUP SCRIPT FILES!
[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={{YOUR-GUID-HERE}}
AppName=Kaboom
AppVersion=1.0
DefaultDirName={pf}\Kaboom
DefaultGroupName=Kaboom
UninstallDisplayIcon={app}\Kaboom.exe
OutputDir=.
OutputBaseFilename=kaboom-setup-1.0
Compression=lzma
SolidCompression=yes
[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
[Files]
Source: "Kaboom.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "Client\images\bombe-icon.ico"; DestDir: "{app}"; Flags: ignoreversion
[Icons]
Name: "{group}\Kaboom"; Filename: "{app}\Kaboom.exe"
Name: "{group}\{cm:UninstallProgram,Kaboom}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\Kaboom"; Filename: "{app}\Kaboom.exe"; Tasks: desktopicon
Name: "{userappdata}\Microsoft\Internet Explorer\Quick Launch\Kaboom"; Filename: "{app}\Kaboom.exe"; Tasks: quicklaunchicon
[Run]
Filename: "{app}\Kaboom.exe"; Description: "{cm:LaunchProgram,Kaboom}"; Flags: nowait postinstall skipifsilent
[Code]
function IsPythonInstalled(): Boolean;
var
ResultCode: Integer;
PythonVersion: string;
TempFileName: string;
PythonOutput: TStringList;
begin
Result := False;
TempFileName := ExpandConstant('{tmp}\python_version.txt');
PythonOutput := TStringList.Create();
try
// Check if 'python --version' returns a valid Python 3 version
if Exec('cmd.exe', '/C python --version > ' + TempFileName, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
if FileExists(TempFileName) then
begin
PythonOutput.LoadFromFile(TempFileName);
PythonVersion := PythonOutput.Text;
if Pos('Python 3', PythonVersion) = 1 then
begin
Result := True;
Exit;
end;
end;
end;
// Check if 'python3 --version' returns a valid Python 3 version
if Exec('cmd.exe', '/C python3 --version > ' + TempFileName, '', SW_HIDE, ewWaitUntilTerminated, ResultCode) then
begin
if FileExists(TempFileName) then
begin
PythonOutput.LoadFromFile(TempFileName);
PythonVersion := PythonOutput.Text;
if Pos('Python 3', PythonVersion) = 1 then
begin
Result := True;
Exit;
end;
end;
end;
// If neither command returns a valid Python 3 version, show an error message
MsgBox('Python 3.0 or higher is not installed. Please install Python 3.0 or higher before proceeding.', mbError, MB_OK);
finally
PythonOutput.Free();
if FileExists(TempFileName) then
DeleteFile(TempFileName);
end;
end;
function InitializeSetup(): Boolean;
begin
Result := IsPythonInstalled();
end;