-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstaller.iss
More file actions
194 lines (166 loc) · 6.71 KB
/
Copy pathinstaller.iss
File metadata and controls
194 lines (166 loc) · 6.71 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
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
; VoiceIO Inno Setup Installer Script
; Wraps PyInstaller one-dir output into a proper Windows installer.
;
; Prerequisites:
; 1. Run: pyinstaller voiceio.spec
; 2. Verify dist\voiceio\voiceio.exe exists
; 3. Run: iscc installer.iss
; or: iscc /DAppVersion=0.2.4 installer.iss
; ---------------------------------------------------------------------------
; Preprocessor defines
; ---------------------------------------------------------------------------
#define AppName "VoiceIO"
#define AppExeName "voiceio.exe"
#define AppPublisher "Hugo Montenegro"
#define AppURL "https://github.com/Hugo0/voiceio"
; Version: override from command line (iscc /DAppVersion=0.2.4 installer.iss)
; or defaults to "dev" for local builds.
#ifndef AppVersion
#define AppVersion "dev"
#endif
; ---------------------------------------------------------------------------
; [Setup] — core installer metadata and behaviour
; ---------------------------------------------------------------------------
[Setup]
; Unique GUID for this application (generated once, never change it).
AppId={{E7B3F2A1-5C4D-4E8F-9A6B-1D2E3F4A5B6C}
; Display names shown in the installer wizard and Add/Remove Programs
AppName={#AppName}
AppVersion={#AppVersion}
AppVerName={#AppName} {#AppVersion}
AppPublisher={#AppPublisher}
AppPublisherURL={#AppURL}
AppSupportURL={#AppURL}/issues
AppUpdatesURL={#AppURL}/releases
; Install to "C:\Program Files\VoiceIO" by default
DefaultDirName={autopf}\{#AppName}
; Start Menu folder name
DefaultGroupName={#AppName}
DisableProgramGroupPage=yes
; Let the user choose admin vs current-user install
PrivilegesRequiredOverridesAllowed=dialog
; License file shown during install
LicenseFile=LICENSE
; Installer output
OutputDir=dist
OutputBaseFilename=VoiceIO-{#AppVersion}-windows-setup
; Compression
Compression=lzma2
SolidCompression=yes
; Modern flat UI style
WizardStyle=modern
; Tell Windows that this installer may modify PATH
ChangesEnvironment=yes
; Uninstall icon in Add/Remove Programs
UninstallDisplayIcon={app}\{#AppExeName}
; 64-bit install on 64-bit Windows
ArchitecturesInstallIn64BitMode=x64compatible
; ---------------------------------------------------------------------------
; [Languages] — installer UI language
; ---------------------------------------------------------------------------
[Languages]
Name: "english"; MessagesFile: "compiler:Default.isl"
; ---------------------------------------------------------------------------
; [Tasks] — optional checkboxes shown to the user
; ---------------------------------------------------------------------------
[Tasks]
Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{cm:AdditionalIcons}"; Flags: unchecked
Name: "addtopath"; Description: "Add VoiceIO to PATH (lets you run 'voiceio' from any terminal)"; GroupDescription: "System integration:"
; ---------------------------------------------------------------------------
; [Files] — what gets copied into the install directory
; ---------------------------------------------------------------------------
; Recursively copy the entire PyInstaller one-dir output.
; "ignoreversion" means always overwrite; "recursesubdirs" handles the
; _internal folder and all bundled DLLs/packages.
[Files]
Source: "dist\voiceio\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
; ---------------------------------------------------------------------------
; [Icons] — Start Menu and desktop shortcuts
; ---------------------------------------------------------------------------
[Icons]
; Start Menu shortcut (always created)
Name: "{autoprograms}\{#AppName}"; Filename: "{app}\{#AppExeName}"
; Desktop shortcut (only if the user ticked the checkbox)
Name: "{autodesktop}\{#AppName}"; Filename: "{app}\{#AppExeName}"; Tasks: desktopicon
; ---------------------------------------------------------------------------
; [Registry] — PATH modification (per-user or system-wide, matching install scope)
; ---------------------------------------------------------------------------
; When the user selects "Add to PATH", append {app} to the PATH variable.
; Using {code:GetPathRoot} to pick HKCU or HKLM based on install mode.
[Registry]
Root: "HKCU"; Subkey: "Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Tasks: addtopath; Check: not IsAdminInstallMode
Root: "HKLM"; Subkey: "SYSTEM\CurrentControlSet\Control\Session Manager\Environment"; ValueType: expandsz; ValueName: "Path"; ValueData: "{olddata};{app}"; Tasks: addtopath; Check: IsAdminInstallMode
; ---------------------------------------------------------------------------
; [Run] — post-install action
; ---------------------------------------------------------------------------
[Run]
Filename: "{app}\{#AppExeName}"; Parameters: "--version"; Description: "Verify installation"; Flags: runhidden nowait postinstall skipifsilent
; ---------------------------------------------------------------------------
; [Code] — Pascal Script for install/uninstall cleanup
; ---------------------------------------------------------------------------
[Code]
// Remove {app} from PATH on uninstall
procedure RemoveFromPath();
var
Path: String;
AppDir: String;
P: Integer;
RootKey: Integer;
SubKey: String;
begin
AppDir := ExpandConstant('{app}');
if IsAdminInstallMode then
begin
RootKey := HKEY_LOCAL_MACHINE;
SubKey := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment';
end
else
begin
RootKey := HKEY_CURRENT_USER;
SubKey := 'Environment';
end;
if not RegQueryStringValue(RootKey, SubKey, 'Path', Path) then
exit;
// Remove ";{app}" or "{app};" from the PATH string
P := Pos(';' + AppDir, Path);
if P > 0 then
begin
Delete(Path, P, Length(AppDir) + 1);
RegWriteExpandStringValue(RootKey, SubKey, 'Path', Path);
end
else
begin
P := Pos(AppDir + ';', Path);
if P > 0 then
begin
Delete(Path, P, Length(AppDir) + 1);
RegWriteExpandStringValue(RootKey, SubKey, 'Path', Path);
end
else
begin
P := Pos(AppDir, Path);
if P > 0 then
begin
Delete(Path, P, Length(AppDir));
RegWriteExpandStringValue(RootKey, SubKey, 'Path', Path);
end;
end;
end;
end;
// Clean up old files before installing a new version (handles upgrades cleanly)
procedure CurStepChanged(CurStep: TSetupStep);
begin
if CurStep = ssInstall then
begin
// Remove the old _internal directory to avoid stale DLLs after upgrade
if DirExists(ExpandConstant('{app}\_internal')) then
DelTree(ExpandConstant('{app}\_internal'), True, True, True);
end;
end;
procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep);
begin
if CurUninstallStep = usPostUninstall then
begin
RemoveFromPath();
end;
end;