-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathsetup.iss
More file actions
103 lines (89 loc) · 3.31 KB
/
setup.iss
File metadata and controls
103 lines (89 loc) · 3.31 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
#define MyAppName "Cutting Optimizer Pro"
#define MyAppVersion "1.2.0"
#define MyAppPublisher "Mehdi Harzallah"
#define MyAppURL "https://github.com/opestro"
#define MyAppExeName "Cutting-Optimizer-Pro.exe"
[Setup]
; NOTE: The value of AppId uniquely identifies this application.
AppId={{ElHamdulilah}}
AppName={#MyAppName}
AppVersion={#MyAppVersion}
AppPublisher={#MyAppPublisher}
AppPublisherURL={#MyAppURL}
AppSupportURL={#MyAppURL}
AppUpdatesURL={#MyAppURL}
DefaultDirName={autopf}\{#MyAppName}
DefaultGroupName={#MyAppName}
OutputDir=installer
OutputBaseFilename=CuttingOptimizerPro_Setup
Compression=lzma
SolidCompression=yes
; Require admin rights to install
PrivilegesRequired=admin
; Set minimum Windows version
MinVersion=6.1
; Architecture settings
ArchitecturesAllowed=x64
ArchitecturesInstallIn64BitMode=x64
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
Name: "french"; MessagesFile: "compiler:Languages\French.isl"
Name: "arabic"; MessagesFile: "compiler:Languages\Arabic.isl"
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
[Files]
; Main executable and dependencies
Source: "dist\{#MyAppExeName}"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs
; Fonts
Source: "fonts\*"; DestDir: "{fonts}"; FontInstall: "Noto Sans Arabic"; Flags: onlyifdoesntexist uninsneveruninstall
; Icons
Source: "icons\*"; DestDir: "{app}\icons"; Flags: ignoreversion recursesubdirs
; Configuration files
Source: "translations.json"; DestDir: "{app}"; Flags: ignoreversion
Source: "version.json"; DestDir: "{app}"; Flags: ignoreversion
[Dirs]
; Create AppData directories during installation
Name: "{userappdata}\{#MyAppName}"
Name: "{userappdata}\{#MyAppName}\logs"
Name: "{userappdata}\{#MyAppName}\output"
[Icons]
Name: "{group}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"
Name: "{group}\{cm:UninstallProgram,{#MyAppName}}"; Filename: "{uninstallexe}"
Name: "{autodesktop}\{#MyAppName}"; Filename: "{app}\{#MyAppExeName}"; Tasks: desktopicon
[Run]
Filename: "{app}\{#MyAppExeName}"; Description: "{cm:LaunchProgram,{#StringChange(MyAppName, '&', '&&')}}"; Flags: nowait postinstall skipifsilent
[Code]
// Check if .NET Framework 4.7.2 or later is installed
function IsDotNetDetected(): boolean;
var
success: boolean;
release: cardinal;
begin
success := RegQueryDWordValue(HKLM, 'SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full', 'Release', release);
result := success and (release >= 461808); // .NET 4.7.2 or later
end;
// Initialize setup
function InitializeSetup(): Boolean;
begin
if not IsDotNetDetected() then begin
MsgBox('This application requires .NET Framework 4.7.2 or later.'#13#13
'Please install it and run this setup again.',
mbInformation, MB_OK);
result := false;
end else
result := true;
end;
// Create application data folder during installation
procedure CurStepChanged(CurStep: TSetupStep);
var
AppDataPath: string;
begin
if CurStep = ssPostInstall then begin
AppDataPath := ExpandConstant('{userappdata}\{#MyAppName}');
if not DirExists(AppDataPath) then
CreateDir(AppDataPath);
// Create logs directory
if not DirExists(AppDataPath + '\logs') then
CreateDir(AppDataPath + '\logs');
end;
end;